On Sunday, 16 November 2014 at 13:39:24 UTC, FrankLike wrote:
Many old projects need move from x86 to x64,but the 'length' type is size_t,it will change on x64,so a lot of work must to do.but I find some info which is help for d:
http://www.dotnetperls.com/array-length.
it means:
test length and longlength, and found 'test longlength' is slower than 'test length'.

  0.64 ns   Length
  2.55 ns   LongLength

I love D.So I don't want my app on x64 slower than on x86.

Hope change in 2.067.

Thank you all.

At least on x86, I would recommand to cast size_t in "int" almost everytime for speed.

- signed overflow is undefined behaviour and optimizers can take advantage of it. - 64-bits instructions on x86 takes more bytes to encode. i-cache and instruction decoding suffer. - 32-bits instructions on x86 fill the upper range with zeroes, so that false dependencies are eliminated.

For these reasons 32-bits ops on x86 are more often than not faster than "native"-sized int, opposite what intuition would tell. For better or worse, int has been made the fastest integer type by chip-makers.

Reply via email to