Associative Array potential performance pitfall?
dayllenger
dayllenger at protonmail.com
Fri Mar 13 10:43:32 UTC 2020
On Friday, 13 March 2020 at 03:40:11 UTC, Adnan wrote:
> Where am I losing performance?
It is nonsensical to say without measuring. Humans are
notoriously bad at predicting performance issues. Wrap all your
hardworking code into a loop with like 100 iterations, compile
and run:
$ perf record -g ./app file.txt && perf report
Measure dmd debug build first, then ldc2 -release -O.
Besides what H. S. Teoh said, these things help:
- disable GC before doing the job and enable it afterwards
- use .byLineCopy instead of lines(), it's faster
- use .byKeyValue when printing the results, it's lazy and
returns both key and value
90ms after vs 215ms before
More information about the Digitalmars-d-learn
mailing list