Myths about porting a 32-bit application to a 64-bit application

sundip sharma
4 min readFeb 26, 2021

Overview

64-bit systems are becoming commonplace in servers and desktops. Many organizations have understood the benefits of 64-bit applications and are now facing the need to port applications from 32-bit to 64-bit environments. With the introduction of Intel® 64 Architecture and other 64-bit processors, making 64-bit-ready software has become increasingly important and needed at the moment.

Developers are porting their applications to 64-bit platforms. Most code runs directly without problems — but there are problems that developers should be aware of before porting the application. This paper illustrates some problems while porting an application to 64-bit and also demonstrates how to use a 64-bit system as a development platform for both 32-bit and 64-bit code. It will give hints, especially to application and library developers on writing portable code using the MS C/C++ Compiler Collection.

Myths about 64-bit application

Now 64-bit PCs are the norm, and virtually all new Windows installations use a 64-bit operating system.

The 64-bit version of Windows 8 (for example) offers several benefits, primarily due to its ability to manage/address a larger amount of system memory. More memory (typical workstation PCs now have 8GB or even more) enabled, more processes at the same time. They will run faster because there is less of a need to swap information out of memory and onto disk; disk-based I/O is now less of a performance bottleneck.

However, apart from the real benefits, there are also some myths about 64-bit computing that persist. I’ll attempt to dispel a few of those here.

Myths about 64-bit applications

Porting the application to 64-bit makes the application twice as fast: FALSE

Porting the application to 64-bit does not make your computations twice faster but makes it slower in some cases only. Even, in theory, some examples of calculations are slower due to large native pointer representation.

Memory addresses are bigger in the 64-bit-world, and complex data structures use a lot of 64-bit values even if they only need 32-bit values. The reason performance drops is that although address width has gotten bigger, processor memory caches have not got bigger in terms of overall Kilo bytes available. Thus, drop out of L1 and L2 cache more often. Hence cache misses go up, and speed goes down.

Example: Searching Queen for Mario in 64-bit memory space will take more time compared to searching in 32-bit memory space.

This question may come up: “ Why should someone port the application to 64-bit?”

The main reason one should go with 64-bit architecture is to address a larger memory space (and flow more bytes through the data bus). Especially for heap-intensive apps(needs more than around 1.5 GB of RAM) have a lot to gain by going 64-bit.

The foremost reason is that 64-bit apps are fast because newer 64-bit machines have faster processors with multiple cores, more memory to reduce I/O, and more registers in the CPU to complete operations more efficiently. These are usually paired with faster storage technology and other infrastructure improvements, Hence this results in faster throughput.

Computation results will be twice as accurate: FALSE

64-bit applications can indeed store larger numbers with more precision in 64-bits than applications can in 32-bits. But even before 64-bit architecture, most programming languages offered intrinsic data types with a 64-bit storage length.

I’ll be able to process twice as much data: PARTIALLY TRUE

A 64-bit process can address more memory, so memory-intensive operations can benefit from this. However, not all operations are constrained by system memory.

Example: Database-related applications are more dependent on I/O performance. A 64-bit system might have better I/O, but that’s not directly related to the 64-bit application aspect.

Modifying project configuration(Target architecture, Target Platform, etc) for the build process is enough to port the application: FALSE

In real life, the fun begins once you make the configuration change you will face the real challenges and applications need to deeply study for compilation and runtime issue

Advantages of the 64-bit processor over 32-bit

Memory Addressing

A 32-bit processor can only make use of RAM of up to 4 GB. In other words, a 32-bit processor can store memory addresses of up to 4 GB. A 64-bit processor can store memory addresses of up to 16 billion GB.

Calculation Speed

A 64-bit processor can perform 64-bit integer operations just as quickly as 32-bit integer operations, but a 32-bit processor performs 64-bit calculations much more slowly.

Operating system and App supports

OS and App should support 64-bit architecture to take advantage of 64-bit processors. 32-bit software can run on 64-bit hardware but vice versa is not possible.

Apart from the above 3 points shift to 64-bit processors gives CPU more memory bandwidth, more efficient instruction set with more registers. Which makes 64-bit devices significantly faster. To take advantage of 64-bit processor software should be built to support 64-bit runtime.

--

--