Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should application perform in 64-bit vs. 32-bit intel architectures?

I want to know the relative performances of a normal C++ application in the following scenarios:

  1. Built as 32-bit app, run on Intel 64-bit processor (x64-64)
  2. Built as 32-bit app, run on Intel 32-bit processor (x86)
  3. Built as 64-bit app.

Also, what factors should I consider when modifying / developing the application to make it to run faster on 64-bit processors?

like image 317
Smash Avatar asked Oct 15 '09 06:10

Smash


People also ask

What is the difference between 32bit and 64bit applications?

A 32-bit system has a limit of 32 bit Windows 3.2 GB of RAM. The limit in its addressable space doesn't allow you to use the entire physical memory space of 4GB. A 64-bit system enables its users to store up to 17 Billion GB of RAM.

What is the difference between 32-bit & 64-bit architectures?

A 32-bit system can access 232 different memory addresses, i.e 4 GB of RAM or physical memory ideally, it can access more than 4 GB of RAM also. A 64-bit system can access 264 different memory addresses, i.e actually 18-Quintillion bytes of RAM.

What is an advantage of 64-bit architecture over 32-bit?

Here's why it matters. Simply put, a 64-bit processor is more capable than a 32-bit processor because it can handle more data at once. A 64-bit processor can store more computational values, including memory addresses, which means it can access over 4 billion times the physical memory of a 32-bit processor.

When should I use 32bit vs 64bit?

When it comes to computers, the difference between 32-bit and a 64-bit is all about processing power. Computers with 32-bit processors are older, slower, and less secure, while a 64-bit processor is newer, faster, and more secure.


2 Answers

Short answer: you probably won't notice much of a difference.

Longer answer: 64-bit x86 has more general purpose registers, which gives the compiler more of an opportunity to optimize local variables into registers for faster access. the compiler can also assume more modern features, eg. not having to optimize code for a 386, and can assume your CPU has stuff like SSE instead of the old x87 FPU for floating point math. but pointers will be twice as wide, which is worse for the cache.

like image 96
asveikau Avatar answered Sep 27 '22 16:09

asveikau


CPU-intensive programs might be noticeably faster on 64-bit. The processor has 16 instead of 8 general purpose registers available which are also twice as wide (64 instead of 32 bits).

Also the number of registers for SSE instructions is doubled from 8 to 16 which helps for multimedia-applications or other applications which do a lot of floating-point computations.

For details see x86-64 on Wikipedia.

One thing that has not been mentioned yet is that 64-bit versions of operating systems such as Windows and Linux use a different calling convention for function calls on 64-bit systems; instead of passing arguments on the stack, arguments are (preferrably) passed in registers, which is in principle faster. So software will be faster because there is less function call overhead.

like image 38
Jesper Avatar answered Sep 27 '22 17:09

Jesper