我們以一個Mac上最為常用的軟件,Adobe Photoshop為例,Adobe的幫助文檔 64-bit OS benefits, limitations 說明了PS在64位的MAC下可以提升8-12%的速度,同時在可用內存增大的情況下64位可以通過提升這些操作的速度來減少操作時間。但是也有一些軟件由于其算法原因,在優(yōu)化完成之后能夠獲得多達200%的性能提升,也有軟件獲得了負優(yōu)化,而這一點是和代碼本身算法有關的。而且說實在的,10%的平均性能提升在直觀的用戶層面也確實感受不到太多的變化。
根據Wiki,64bit因為能夠提供更大的寄存器,在執(zhí)行大量循環(huán)的語句的時候可以讓變量一直停留在寄存器里,通過減少對其他存儲的訪問來加快執(zhí)行時間;同時通過提供更大的尋址空間,在處理大文件的時候可以減少對磁盤的訪問以大幅提升訪問速度。這點在微軟自己做的針對Windows Server 2003 R1的x64與x86版本的數據庫測試(Active Directory Performance for 64-bit Versions of Windows Server 2003)中也能反映出來:
For the database with 100,000 users, performance of the 32-bit version and the 64-bit version was within 10 percent for most operations, proving that both operating systems performed similarly when all objects were cached in memory. In our tests, a 100,000-user directory was capable of being stored in memory for both the 32-bit version and the 64-bit version.
For the database with 3 million users,the 64-bit version outperformed the 32-bit version by 200 percent to 10,000 percent for most operations because the 64-bit version could cache all users in memory while the 32-bit version could not.
以上64bit系統(tǒng)的內存是32GB,而32bit系統(tǒng)的內存是4GB。
可以看出,當二者的內存都能全部讀入待處理的數據的時候,兩個系統(tǒng)對數據庫的操作性能主要體現(xiàn)在64bit的寄存器能夠同時容納更多的數據,從而減少cache與RAM的訪問,各種操作平均能獲得10%的性能提升;
而面對百萬量級的數據庫,顯然32bit的內存已經無法全部讀入待處理的數據了,但是此時64bit系統(tǒng)的內存仍然可以讀入全部的數據庫,這時在32bit的系統(tǒng)上就會發(fā)生對硬盤的頻繁讀寫,此時兩種系統(tǒng)的性能差距就幾乎等于硬盤與內存的性能差距,所以性能相差甚至可達2-100倍。
最后附上Adobe幫助文檔中的相關部分:
Processor speed and Photoshop operations
Although the 64-bit version of Photoshop speeds up some operations, it doesn't speed all of them. And, it doesn't speed the operation equally. Generally, operations run approximately 8-12% faster. Overall, processor speed is not the main advantage of using the 64-bit version, except when you run actions on large files. Photoshop writes data to the hard disk incrementally while you pause in Photoshop. When you run actions, there are no pauses for Photoshop to write to the disk. Therefore, Photoshop writes to the disk while the action runs. The increase in processor speed increases these processes.