Recent

Author Topic: Code speed in 64bit compiler vs 32bit compiler  (Read 1433 times)

tetrastes

  • Hero Member
  • *****
  • Posts: 600
Re: Code speed in 64bit compiler vs 32bit compiler
« Reply #15 on: November 10, 2024, 08:04:25 pm »
@ad1mt
Just in case, this may be interesting, if you didn't read it https://forum.lazarus.freepascal.org/index.php/topic,40099.msg276637.html#msg276637

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10555
  • Debugger - SynEdit - and more
    • wiki
Re: Code speed in 64bit compiler vs 32bit compiler
« Reply #16 on: November 10, 2024, 08:34:17 pm »
A very simple code test I just did, adding integers together, is sometimes faster in the 32bit compiler, and sometimes faster in the 64bit compiler.

Well, there are lots of factors. Both code and data may change in size and by that may be differently aligned, and that can make surprising speed differences.

Say you have a loop in your code, then its alignment depends on how much other code is in front => but depending on its size, if the loop has a specific alignment, it may run faster.
In the end it may happen more likely under 32 bits.

Similar stuff can happen with data, if data that is used together ends up in a single cache line.

There are some directives to set up alignment for those things. You can play around with that. In some cases alignment to boundaries up to 32byte bounds can change speed. But its not a guarantee.  It can go the other way to.

 

TinyPortal © 2005-2018