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:

Mar 24
parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 3/24/22 07:54, Mike Parker wrote:

 The blog:
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