David Eagen:

> I admit to being very new to D so perhaps I'm really doing something wrong.

This program uses string hashing, regular expressions, and by line file 
iteration. Those are among the most common operations done by script-like 
programs.

Some suggestions for your D code:
- Use the new regex engine
- Use File.byLine instead of BufferedFile
- don't use the built-in sort, use std.algorithm.sort
- try to minimize the number of memory allocations
- try to disable the GC if and when you think it's a good thing to do;
- avoid casts where possible.
- writef("%s,%d\n"  ==> writefln("%s,%d"

For Phobos devs: is the new regex engine able to support verbose regexes (it 
means that allow newlines, empty space and even comments)? In practice I only 
use them in Python.

Bye,
bearophile

Reply via email to