Bye bye, fast compilation times

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Feb 5 21:27:57 UTC 2018


One of my D projects for the past while has been taking unusually long
times to compile.  This morning, I finally decided to sit down and
figure out exactly why. What I found was rather disturbing:

------
import std.regex;
void main() {
	auto re = regex(``);
}
------

Compile command: time dmd -c test.d

Output:
------
real    0m3.113s
user    0m2.884s
sys     0m0.226s
------

Comment out the call to `regex()`, and I get:

------
real    0m0.285s
user    0m0.262s
sys     0m0.023s
------

Clearly, something is wrong if the mere act of compiling a regex causes
a 4-line program to take *3 seconds* to compile, where normally dmd
takes less than a second.

Apparently, the offending Phobos PR was merged late last year:

	https://issues.dlang.org/show_bug.cgi?id=18378

This is a serious slap-in-the-face to dmd's reputation of super-fast
compilation.  Makes our "fast code, fast" slogan look more and more
ironic. :-(

(Note: this particular regression is in *compilation* times; it's not
directly related to the *performance* of the regex code itself. The
latter department as also suffered a regression; see for example:
https://github.com/dlang/phobos/pull/5981.)


T

-- 
Маленькие детки - маленькие бедки.


More information about the Digitalmars-d mailing list