Nightinggale
Deity
- Joined
- Feb 2, 2009
- Messages
- 5,378
51% mean you are only using half of your physical memory. If you run out, it will use the HD as well, which is much slower.Yeah, I wondered about that, but since the vanilla coders didn't bother with anything less than an int most times I didn't either. I think you mentioned it before but memory isn't all that big an issue these days. Looking at my Task Manager with 9 Apps running including M:C it shows FireFox here using 290 MB while M:C only uses 230 MB. With all the other apps running it still shows 51% of my memory still available. The crazy thing is I don't even know what all that means, if anything at all.
A 32 bit system can only use 4 GB including the HD, though a CPU with extended memory can use 6. Windows XP can only use 3 for unknown reasons.
On 64 bit systems (most computers today, except the one I'm using right now

There is another part to this as well. Quite a lot of the time spent waiting for the CPU is actually spent by the CPU waiting for memory I/O. Whenever the code loops an array, it will actually be faster if the array uses less space in memory (read: less memory to transfer to the CPU).
Writing to something smaller than int could be slower though as the game has to load the other vars and then copya block of 32 bit to memory. This mean often written to and rarely looped arrays could benefit from being ints while read only arrays (like XML data storage) really benefits from being smaller.
Vanilla likely uses int everywhere to reduce development time (some parts of the code appears to be rushed to meet a deadline). The savegame code can't handle short or char. As a result JIT arrays converts to int and saves those. On read, it reads ints and copy those to the array. Come to think of it, it stores a bunch of unused bytes, which increases savegame size. Maybe I should look into saving more efficient to reduce file size. Like variable sizes, it isn't critical and can wait.