Request for comments: std.d.lexer

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Feb 8 07:28:30 PST 2013


08-Feb-2013 19:12, Jacob Carlborg пишет:
> On 2013-02-08 16:08, Brian Schott wrote:
>
>> http://hackerpilot.github.com/experimental/std_lexer/images/times3.png
>>
>> Your suggestions seem to have worked. We're below 20ms on my machine for
>> the datetime module.
>
> DMD is still consistently faster, :(
>

Keep in mind the D runtime start-up cost. In the end on small files DMD 
always wins because of slim C-runtime.

To estimate runtime startup lag I've compared run times of

int main(){ return 0; } in C (gcc):

------------------------
Total time (ms): 31637.7
Repetitions    : 35000
Sample mode    : 0.8 (23649 ocurrences)
Median time    : 0.873
Avg time       : 0.903935
Std dev.       : 0.204107
Minimum        : 0.552
Maximum        : 9.057
95% conf.int.  : [0.503892, 1.30398]  e = 0.400043
99% conf.int.  : [0.378189, 1.42968]  e = 0.525746
EstimatedAvg95%: [0.901796, 0.906073]  e = 0.00213832
EstimatedAvg99%: [0.901125, 0.906745]  e = 0.00281023

void main(){} in D (ldc):
------------------------
Total time (ms): 15429.4
Repetitions    : 7000
Sample mode    : 2.1 (1785 ocurrences)
Median time    : 2.128
Avg time       : 2.2042
Std dev.       : 0.466834
Minimum        : 1.286
Maximum        : 19.933
95% conf.int.  : [1.28922, 3.11918]  e = 0.914978
99% conf.int.  : [1.00171, 3.40668]  e = 1.20248
EstimatedAvg95%: [2.19326, 2.21514]  e = 0.0109361
EstimatedAvg99%: [2.18983, 2.21857]  e = 0.0143724
dmitry at dmitry-VirtualBox ~ $

I think that the mode could serve as an indicator of the most probable 
outcome.
For me it's around 0.8 vs 2.1 ms. D runtime rides on top of C one + plus 
the same OS costs to launch a process, so from now on let's keep in mind 
these extra ~ 1.3 ms of bias in favor of C-based lexer.


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list