std.regex is fat

Chris Katko ckatko at gmail.com
Sun Oct 14 02:44:55 UTC 2018


On Friday, 12 October 2018 at 13:42:34 UTC, Alex wrote:
> On Friday, 12 October 2018 at 13:25:33 UTC, Chris Katko wrote:
>> Like, insanely fat.
>>
>> All I wanted was a simple regex. The second include a regex 
>> function, my program would no longer compile "out of memory 
>> for fork".
>>
>> /usr/bin/time -v reports it went from 150MB of RAM for D, 
>> DAllegro, and Allegro5.
>>
>> To over 650MB of RAM, and from 1.5 seconds to >5.5 seconds to 
>> compile. Now I have to close all my Chrome tabs just to 
>> compile.
>>
>> Just for one line of regex. And I get it, it's the overhead of 
>> the library import, not the single line. But good gosh, more 
>> than 3X the RAM of the entire project for a single library 
>> import?
>>
>> Something doesn't add up!
>
> Hm... maybe, you run into this:
> https://forum.dlang.org/post/mailman.3091.1517866806.9493.digitalmars-d@puremagic.com

So wait, if their solution was to simply REMOVE std.regex from 
isEmail. That doesn't solve the regex problem at all. And from 
what I read in that thread, this penalty is paid per template 
INSTANTIATION which could explode.

  1 - Does anyone know WHY it's so incredibly fat?

  2 - If this isn't going to be fixed anytime soon, shouldn't 
there be a DISCLAIMER on the documentation? (+potential 
workarounds like keeping regex queries in their own file.)

I mean, this kind of thing shouldn't require looking through 
forums. It's a clear bug, and if it's a WONTFIX (even 
temporarily), it should be documented clearly as such.

If I'm running into this issue, how many other people already 
did, and possibly even gave up on using D?




More information about the Digitalmars-d-learn mailing list