Lexer in D

Namespace rswhite4 at googlemail.com
Mon Mar 11 09:36:59 PDT 2013


> extends if possible.
>
> http://dpaste.dzfl.pl/f86e5db6
>
> import core.stdc.stdlib;
> void main()
> {
>   auto p1 = malloc(14);
>   auto p2 = realloc(p1, 15);
>   assert(p1 is p2);
> }

Cool, nice to know.

Currently I have this benchmark:

Without memory reserve:

------------------------
Total time (ms): 6779.16
Repetitions    : 200
Sample mode    : 33 (73 ocurrences)
Median time    : 33.689
Avg time       : 33.8958
Std dev.       : 1.86754
Minimum        : 31.414
Maximum        : 52.237
95% conf.int.  : [30.2355, 37.5561]  e = 3.66031
99% conf.int.  : [29.0853, 38.7063]  e = 4.81047
EstimatedAvg95%: [33.637, 34.1546]  e = 0.258823
EstimatedAvg99%: [33.5556, 34.2359]  e = 0.340151

With memory reserve:

------------------------
Total time (ms): 5945.1
Repetitions    : 200
Sample mode    : 29 (68 ocurrences)
Median time    : 29.3215
Avg time       : 29.7255
Std dev.       : 2.083
Minimum        : 27.458
Maximum        : 45.32
95% conf.int.  : [25.6429, 33.8081]  e = 4.08261
99% conf.int.  : [24.36, 35.0909]  e = 5.36546
EstimatedAvg95%: [29.4368, 30.0142]  e = 0.288684
EstimatedAvg99%: [29.3461, 30.1049]  e = 0.379396

But I does not gain that much:
------------------------
Total time (ms): 10833
Repetitions    : 200
Sample mode    : 53 (105 ocurrences)
Median time    : 53.848
Avg time       : 54.1652
Std dev.       : 1.72681
Minimum        : 52.118
Maximum        : 69.703
95% conf.int.  : [50.7807, 57.5497]  e = 3.38448
99% conf.int.  : [49.7172, 58.6131]  e = 4.44796
EstimatedAvg95%: [53.9259, 54.4045]  e = 0.239319
EstimatedAvg99%: [53.8507, 54.4797]  e = 0.314518

Seems to be the wrong point of optimizations.


More information about the Digitalmars-d-learn mailing list