size_t for length on x64 will make app slower than on x86?

Flamencofantasy via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 16 08:12:33 PST 2014


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.



More information about the Digitalmars-d mailing list