Is there any performance gain with 64bit Ogre?

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
User avatar
suny
Bronze Sponsor
Bronze Sponsor
Posts: 54
Joined: Thu Mar 12, 2020 5:53 pm
x 26

Is there any performance gain with 64bit Ogre?

Post by suny »

Newbie question:

I'm compiling my game and all the libraries (and Ogre) in 32bits.
I tried to understand if, except for the fact that the app could address more memory, there could be any gain with 64bits vs 32, but I'm not sure (I read some inconsistent comments on the subjects).

So:
-should I compile my game in 64bits?
-Should I expect more performance, less, or the same?
S.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4757
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1044
Contact:

Re: Is there any performance gain with 64bit Ogre?

Post by dark_sylinc »

Too many variables:
  • 64 bit has more registers available so it should be faster
  • Integer Math on 64 bit operations is faster on 64 bit. It's rare to do a lot of operations that require 64 bits though.
  • 32 bit uses smaller pointers (4 bytes per ptr) which means data is smaller and thus more stuff fits in cache. Also lower bandwidth usage. So 32 bit wins here.
  • 64 bit defaults to floating point math on scalar SSE, 32 bit defaults to x87. The x87 is being abandoned so newer models will perform faster on SSE because that's where the focus is. However you can compile as 32-bit and manually tell the compiler to use SSE instead of x87 for math. So this should be more or less a tie if you're careful; otherwise 64 bit wins (except for older HW)
  • Very old CPUs might perform faster on 32 bit
  • 32 bit on 64 bit OS means it's more likely a 64 bit DLL is already loaded than a 32 bit one. So cold start up time could be larger on 32 bit. 64 bit wins.
Overall 64-bit wins because that's where all the focus (HW, OS and compiler) is. The reverse was true for older stuff (i.e. 32 bit being more predominant, known and tested in the past).
Also if you take advantage of 64-bit specific stuff (e.g. mmap entire disk files without worrying about running out of virtual address space), you can get gigantic wins.

A few years ago shipping a 32-bit binary for 32-bit OSes was a reasonably thing to do, but 32-bit OS deprecation went on a fast track after Meltdown and Spectre (it's really hard to enforce the mitigations on 32-bit OSes)

Update: I forgot what it means to you: If you take your 32 bit SW and compile it as 64, expect your SW to run "more or less the same". No major differences unless you were hit hard by a bottleneck (i.e. if you were heavily bandwidth bound expect now to run slower, or you had very high register pressure expect now to run faster, etc).
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 232
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 67

Re: Is there any performance gain with 64bit Ogre?

Post by sercero »

I got a huge speedup when migrating to 64 bits, but other things changed as well:
OGRE 1.8 to OGRE 1.11
TDM MinGW 5.1 (32bit) to MinGW 8.1 (64bit)

An almost empty scene that was running at 750 fps in OGRE 1.8 went on to run at 2500 fps in OGRE 1.11.

I think that there were both improvements in the version jumps but also in the transition to 64bits, you should try it.
User avatar
suny
Bronze Sponsor
Bronze Sponsor
Posts: 54
Joined: Thu Mar 12, 2020 5:53 pm
x 26

Re: Is there any performance gain with 64bit Ogre?

Post by suny »

Thanks for your inputs!
S.
Post Reply