Каковы более низкие преимущества уровня и недостатки 64-bit/32-bit?

Я думаю, что C++ пойдет вышедший из моды за следующие 10 лет просто тот же путь, как блок сделал. Я - профессиональный игровой программист в течение больше этих 15 лет. В начале партии 90-х людей сказал, что C не достаточно эффективен для игр. В конце 90-х те же люди сказали, что C в порядке, но C++ является просто слишком медленным для важных приложений производительности, таких как игры. Теперь C++ является стандартным высокопроизводительным языком, и люди утверждают, что другие языки были бы слишком медленными. Тем временем сегодняшние игры используют языки сценария как Lua, Python или Unrealscript для игровой логики, которые в десять раз медленнее, чем C# или Java.

C++ намного быстрее, когда Вы делаете математику в своей игре. Выполнение линейной алгебры является крайне медленным в C# или Java. Однако это - только часть (10 - 25%) игры. Когда дело доходит до игры узкое место логики является доступом к памяти, настолько использующий другой язык значительно не уменьшает производительность. Сторона инструмента игры, которые используют, чтобы быть 50-80% кода, действительно не требует никакого C++. Это счастливо работает в C#, который достаточно быстр почти для любого инструмента.

также нельзя забывать, что C++ получен из C, который сделан в начале 70-х. Таким образом, C++ является устаревшим во многих отношениях. Самой раздражающей вещью является, вероятно, препроцессор, который уничтожает прозрачность и вызывает безумно долгое время компиляции. Средний уровень техники игровой механизм C++ компилирует за 30-60 минут. В такое время Вы могли скомпилировать каждый C# и проект Java, когда-либо сделанный людьми. Отсутствие саморефлексии и динамического создания кода является также недостатком. Это часто стоит большого количества времени разработки для преодоления на этих недостатках.

, Тем не менее, затраты на разработку C++ много это стоило бы еще больше, чтобы игровая студия рискнула отказом путем переключения на новую технологию, которая еще не доказана в разработке игр. Это - также важный фактор, что большинство опытных игровых программистов использует только C/C++, и у них нет опыта с другими языками, которые определенно увеличили бы риск переключения. Из-за них Вы, вероятно, не будете видеть игровые студии через следующие несколько лет, переключаясь на C#. Однако вероятно, что студия, находящаяся в собственности Microsoft сделает большой хит с игрой C# за следующие 5 лет, которые убедят другие студии, что выполнимо сделать заголовки AAA в C#, и затем Вы будете видеть, что все больше студий переключается на C#.

На данный момент, мой совет: Если Вы хотите сделать многоплатформенный заголовок AAA, у Вас нет никакого другого выбора, чем C++ для части во время выполнения игры. Рассмотрите использование C# для стороны инструмента. Это немного хитро для эффективного соединения управляемого и неуправляемого кода, но на длительном периоде это стоящий усилия Вы тратите на него. Если Вы делаете проект хобби или заголовок B, где производительность менее важна, чем затраты на разработку / время затем забывают C++ и просто используют C# для всего и проводят некоторое дополнительное время для оптимизации математики.

10
задан Gordon Gustafson 23 February 2010 в 20:56
поделиться

7 ответов

64 bit refers to the width of registers, memory addressing space, etc. One benefit is the ability to address more than 4GB of memory.

Wikipedia has an article on 64-bit computing with more details.

Edit: The advantages to more memory are that the operating system and programs have more virtual addressing space--16 exabytes (17.2 billion GB)--and, more importantly, that more physical memory can be added to a system and addressed, causing less swapping of virtual memory to and from disk.

The advantage to wider registers and data buses are that it is easier and faster to move the same amount of data around. An operation that required two or more registers can now be done with one.

So, performance is typically increased when software is recompiled for 64 bits.

A disadvantage is that wider data can mean more space taken by the same data. For instance storing the number 300 requires nine bits. If it's stored in a 32 bit integer, 23 bits are wasted. In 64 bit, that wastage becomes 55 bits. So, without retooling, a simple recompile to 64 bit can yield faster, but slightly more bloated software.

Edit: Also there are 64-bit technology pages here:

17
ответ дан 3 December 2019 в 15:22
поделиться

The difference is exactly 32 bit ;-)

You need 64 bit hardware (processor) to run a 64 bit OS. You need a 64 bit OS to run 64 bit software. This are the dependencies.

  • In a 32 bit system you are limited to addressing 4 GiByte (2^32) memory, in a 64 bit there is a theoretical limit of 2^64 byte.
  • 64 Bit software needs slightly more memory, mainly for pointers are 8 Bytes instead of 4
  • on x86_64, 64 Bit executables need more memory, as there is an additional opcode for many instructions, and thus may run slower
  • on x86_64, 64 Bit software can use more registers and has the potential to run faster
6
ответ дан 3 December 2019 в 15:22
поделиться
  • 64bit systems can directly address significantly more memory
  • 64bit systems can process data in chunks twice as large as 32bit, which helps some operations go more quickly

For some programs, like office automation suites, 32bit vs 64bit makes little observable difference.

But for other applications, such as databases, graphics/video processing, or hosting virtual machines, being able to reach more physical memory at once and being able to process more information with each instruction can make a huge difference in performance.

Note that today, many 32bit chips have 64bit extension functions, as many FPU (math) or SSMD (vector) operations are done in 64bit mode already.

See 32-bit Vs. 64-bit Systems: What's The Difference? for more.

3
ответ дан 3 December 2019 в 15:22
поделиться

I think the best answer would be a comparison in x86 bit x64 assembler

When your x32 bit program registers a variable,for example an integer(5),the code is equivalent to this:

push 5

To Understand things better,'push X' is a shortcut to:

sub esp,4 //substracts esp with 4(4*8=32 bits.That's the size of a pointer in x32 executables) in order to make space for our variable
mov [esp],X //moves variable in @esp

Those registeres are 32 bit(4 bytes long),which is the size of a pointer in any 32 bit programming language.

In 64 bit code,however the size is twice bigger and so are registers.Our register ESP exists in x64 executables,but its not widely used as it is in x32 executables.

Instead all of the registeres get a "R" in front of their name(EAX becomes RAX,ESP becomes RSP,EDX becomes RDX and so on).

So our code in x64 executable won't be any different,except the shortcut for 'push X' will be

sub esp,8
mov [rsp],X

RSP has double the size of ESP - 64 bits,8 bytes.

The bottom line is that x64 bit executables use more memory than x32 bit executables.

2
ответ дан 3 December 2019 в 15:22
поделиться
  1. CPU registers and memory addressing.

  2. The system can reference (see) much more memory.

2
ответ дан 3 December 2019 в 15:22
поделиться

Let's go back to the basics.

99% of computer these days are based on what is referred to as the Von Neumann architecture. Essentially, the computer is in a constant cycle of:

  1. Fetching a command from RAM
  2. Executing the command on the CPU

alt text
(source: wikimedia.org)

When referring to 32/64-bit system (or any other bit size), essentially you are talking about the architecture and implementation of the computer:

  • size of memory space (RAM)
  • size of CPU registers
  • bus size (i.e. between CPU, RAM, I/O, etc...)

If you have a 64-bit system, you have an address space of 2^64. This is why 32-bit system cannot have more than 4GB of RAM. How can you address a memory space which is larger than 2^32?

Regarding the performance differences, there is no clear cut answer (just as there is no clear answer if CISC or RISC architecture is better). It vastly depends on the applications you are using.

To sum: a 64-bit architecture is simply a different way to build a computer. It does not mean it is better, or worse, or does things differently (on a low level, every computer is doing fetch-execute). It's simply a different way of implementing a computer.

2
ответ дан 3 December 2019 в 15:22
поделиться

Exactly the 64bit or 32bit references just to the width of the main bus.

-3
ответ дан 3 December 2019 в 15:22
поделиться