Thread overview
Re: Compiling in std.regex affecting performance
Jan 07, 2012
Andrej Mitrovic
Jan 07, 2012
Trass3r
Jan 07, 2012
Andrew Wiley
Jan 07, 2012
Trass3r
Jan 07, 2012
Andrej Mitrovic
Jan 07, 2012
Denis Shelomovskij
January 07, 2012
Oooh I've just realized something, the *compilation* calls are what's destroying the performance. I was using "dmd test.d && test.exe" instead of just "test.exe" and this would generate a new exe which screwed up the results.

So regex has nothing to do with it. Still, some linkers perform better:

$ dmd -c test.obj
$ link test.obj

Average is ~700usecs. But with ulink:
$ ulink test.obj

Average is ~380 usecs. Interesting!
January 07, 2012
> So regex has nothing to do with it. Still, some linkers perform better:
>
> $ dmd -c test.obj
> $ link test.obj
>
> Average is ~700usecs. But with ulink:
> $ ulink test.obj
>
> Average is ~380 usecs. Interesting!

So much for Optlink being the fastest linker cause it's all written in shiny assembler ^^
January 07, 2012
On Sat, Jan 7, 2012 at 12:03 AM, Trass3r <un@known.com> wrote:
>> So regex has nothing to do with it. Still, some linkers perform better:
>>
>> $ dmd -c test.obj
>> $ link test.obj
>>
>> Average is ~700usecs. But with ulink:
>> $ ulink test.obj
>>
>> Average is ~380 usecs. Interesting!
>
>
> So much for Optlink being the fastest linker cause it's all written in shiny assembler ^^

Well, for one thing, the Optlink that ships with DMD isn't entirely assembly anymore. You'd have to ask Walter how much he's ported to C at this point.
January 07, 2012
> Well, for one thing, the Optlink that ships with DMD isn't entirely assembly anymore. You'd have to ask Walter how much he's ported to C at this point.

I really doubt the C code is much more high level than the original one.
January 07, 2012
07.01.2012 5:12, Andrej Mitrovic пишет:
> Oooh I've just realized something, the *compilation* calls are what's
> destroying the performance. I was using "dmd test.d&&  test.exe"
> instead of just "test.exe" and this would generate a new exe which
> screwed up the results.
>
> So regex has nothing to do with it. Still, some linkers perform better:
>
> $ dmd -c test.obj
> $ link test.obj
>
> Average is ~700usecs. But with ulink:
> $ ulink test.obj
>
> Average is ~380 usecs. Interesting!

No regex call:   ~350 usecs, size: ~800 KiB
With regex call: ~540 usecs (i.e. +54%), size: ~1000 KiB (i.e. +25%)
Deviation is about 10 usecs when repeatedly launching from a console.

Compiler: dmd 2.057 -O -noboundscheck -release, CPU: E6850, OS: Windows XP SP3 32bit.

So what is the explanation of 54% speed decrease?
January 07, 2012
On 1/7/12, Trass3r <un@known.com> wrote:
> So much for Optlink being the fastest linker cause it's all written in shiny assembler ^^

Well I wasn't timing linking, I was timing the app itself. Optlink does actually seem a tiny little bit faster than unilink (we're talking a few milliseconds here), however unilink does a much better job and the resulting exe is smaller and seems to have better performance. Also unilink won't bail out when you have too many symbols (probably because it strips the unused symbols away).

It's a shame they're both closed-source though.