www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Reducing Template Compile Times

reply Mike Parker <aldacron gmail.com> writes:
Sometimes, simple looking template interfaces and implementations 
have a hidden cost in increased compile times. In his latest blog 
post, Max Haughton shows some of those cases, explains what 
causes the increase, and shows how to rewrite your templates when 
possible to alleviate the problem.

The blog:
https://dlang.org/blog/2022/03/24/reducing-template-compile-times/

Reddit:
https://www.reddit.com/r/programming/comments/tmewno/reducing_template_compile_times_in_dlang/
Mar 24
parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 3/24/22 07:54, Mike Parker wrote:

 The blog:
 https://dlang.org/blog/2022/03/24/reducing-template-compile-times/
There is an opportunity for a minor optimization where the following code is introduced in the article. To reduce code compiled for the non-unittest binary, I sometimes define types and import declarations needed only by unittests, inside version(unittest) blocks: version (unittest) { // <-- ADDED import some_unittest_utils; // <-- Added example struct JustInt { int x; } } // <-- ADDED static foreach(_; 0..5) { unittest { JustInt value; value.send; } } Ali
Mar 27