On 4/5/12 2:00 PM, lzzll wrote:
Hey, I wrote some code to benchmark dict list and string in D, python
and lua.
D is a great language, but some library look comparatively slow.
Some where may be wrong, I start D just today.
[snip]

Thanks for the benchmark, good comparisons are always helpful.

I think the one of problems is to!string(int) too slow, snprintf
will better.

You're right. In fact I took a minute to adapt some C++ code I wrote for work into a faster to!string routine. On my machine I get:

$ ./test.py
---- test_dict -----
test dict set (1000000)...      0.64s
test dict get (1000000)...      0.40s
test dict clear (1000000)...    0.09s

---- test_list -----
test list set (1000000)...      0.02s
test list get (1000000)...      0.08s
test list each (1000000)...     0.06s

---- test_str -----
test str find (1000000)...      0.47s
test str replace (1000000)...   0.48s

$ ./test
---- test_dict -----
test dict set (1000000)...      0.729s
test dict get (1000000)...      0.261s
test dict clear (1000000)...    0.000s
---- test_list -----
test list set (1000000)...      0.073s
test list get (1000000)...      0.001s
test list each (1000000)...     0.001s
---- test_str -----
test str find (1000000)...      0.593s
test str replace (1000000)...   0.804s

Not too shoddy! I'll work on adding the better conversion routine to Phobos.


Andrei

Reply via email to