I am not sure your test is significant; calling to!string and
inserting into an AA is likely orders of magnitude slower than
the overhead of shuffling a 64 bit value vs a 32 bit value.
On Sunday, 16 November 2014 at 16:02:20 UTC, FrankLike wrote:
It means where you have uint x = arr.length you should have
had size_t x = arr.length from the very beginning.
I test it :
module aatest;
import std.stdio;
import std.datetime;
import std.conv;
size_t[string] aa;
void ada()
{
for(size_t i=0;i<1000000;i++)
{
aa[to!string(i)] =i;
}
}
void main()
{
StopWatch sw;
sw.start();
ada();
sw.stop();
writeln("\n time is :" , sw.peek().msecs/1000.0," secs");
}
dmd -m64 aatest.d ,and dmd aatest.d -ofaa32.exe
Result:
m64 :0.553 secs;
m32:0.5 secs;
Thank you all.