How would I optimize this parser?
bearophileHUGS at lycos.com
Sat Oct 30 20:00:59 PDT 2010
> Unfortunately, it's quite slow. Can anyone point out what might be the issue(s)?
Very good :-)
- Generally compile your D code using the -w switch (you have missing some overrides and more things)
- Add a main() with some benchmarking examples to your program, so I will have something to optimize for.
- Use the -profile compiler switch on the benchmarking examples to see what's slow.
- Use final classes or final methods where possible and keep an eye on memory allocations. Consider using structs in some places instead of classes.
- Keep in mind that ~ and ~= in arrays isn't a very fast operation. In some cases an Appender helps, and in some cases some workaround may be needed.
See you later,
More information about the Digitalmars-d-learn