Avoid array lookups where simple constants are fine #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A 15 minute fix that gets a big performance boost (about 20-30%)!
The noise is awfully high though, so I'm looking at sample mode mostly it could bigger or a smaller. What I'm seeing I think is that system call overhead is far higher then the time to lex the thing.
Logs of runs on core i5-3170 at my workplace.
dscanner-meta truly utilizes meta-programming unlike the current version (dscanner-old):
dmitry@dmitry-pc ~/Dscanner $ avgtime -r 450 -q ./dscanner-old --tokenCount ../phobos/std/datetime.d
Total time (ms): 8719.33
Repetitions : 450
Sample mode : 22 (81 ocurrences)
Median time : 20.492
Avg time : 19.3763
Std dev. : 2.97428
Minimum : 13.957
Maximum : 25.352
95% conf.int. : [13.5468, 25.2058] e = 5.82948
99% conf.int. : [11.715, 27.0375] e = 7.66123
EstimatedAvg95%: [19.1015, 19.6511] e = 0.274804
EstimatedAvg99%: [19.0151, 19.7374] e = 0.361154
dmitry@dmitry-pc ~/Dscanner $ avgtime -r 450 -q ./dscanner-meta --tokenCount ../phobos/std/datetime.d
Total time (ms): 8114.66
Repetitions : 450
Sample mode : 15 (117 ocurrences)
Median time : 17.304
Avg time : 18.0326
Std dev. : 2.89978
Minimum : 12.55
Maximum : 23.87
95% conf.int. : [12.3491, 23.716] e = 5.68346
99% conf.int. : [10.5633, 25.5019] e = 7.46933
EstimatedAvg95%: [17.7647, 18.3005] e = 0.267921
EstimatedAvg99%: [17.6805, 18.3847] e = 0.352107
dmitry@dmitry-pc ~/Dscanner $