Compilation times and idiomatic D code

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 13 13:16:50 PDT 2017


On 7/13/17 3:23 PM, H. S. Teoh via Digitalmars-d wrote:
> Today, I decided to sit down and refactor my code.  I've heard tell that
> Voldemort types tend to cause an explosion in symbol size, and today I
> thought it'd be interesting to see just how big of a difference this
> actually makes.
> 
> I could not believe my eyes.
> 
> Before the refactoring, my executable sizes (I have 2 executables in
> this codebase) were 37.3MB and 60.0MB, respectively.
> 
> After the refactoring, my executable sizes were, respectively, 8.2MB and
> 10.2MB. That's a 5x and 6x reduction in executable size, respectively.
> Whoa.

Yep.

http://www.schveiguy.com/blog/2016/05/have-your-voldemort-types-and-keep-your-disk-space-too/

I was surprised as well at the reduction. I only noticed the problem 
because when I was debugging my library, the program was taking an 
unreasonably long time to *print a stack trace* (like multiple seconds).

-Steve


More information about the Digitalmars-d mailing list