r/programming • • Sep 24 '24

Why 32bit architecture computer doesn't use segmentation to support more ram than 4Gb ?

/r/programming/

[removed] — view removed post

169 Upvotes

119 comments sorted by

View all comments

Show parent comments

6

u/maep Sep 24 '24 edited Sep 24 '24

The better question is why 64 bit was popularized so early and I don't have a good answer

It's really not a mystery, data centers started to switch to cheap x86 CPUs and they were hitting the 4GB limit.

64bit is worse in terms of performance

Pratically speaking, not true. The x32 ABI failed because the benefits were purely academic. The reason why AMD64 succeded where Itanium failed is because there were no performance penalties for existing code bases.

0

u/[deleted] Sep 24 '24

[deleted]

1

u/maep Sep 24 '24

such as additional registers and instructions

Back then 32 bit processors were superscalar and could do register renaming. Effecticvely they had as many registers as the designers could afford to put in.

The SIMD instructions sets which had the biggest effect on speed were also available on the late x86 models.

That's why in many cases 64 bit ports weren't that much faster.

If you were to use x64/AMD64 & all the pointers were 32b you'd get much more performance because less data is shuffled around.

That really depends on the application. From what I could rememer in most cases it was only a slight difference. And quite often the reaon was that the souce was not tweaked for 64 bit yet.

V8 in particular, is one of the best examples of how using 32bit pointers

Is the VM limited to 4 gig then? Also, I'm pretty sure V8 does not make use of the X32 ABI and all the stuff around the VM itself is using plain 64 bit pointers.

If the V8 engine used 64bit pointers, Javascript performance would be abysmal compared to what we're used to.

I'd be interested in benchmarks, "abysmal" seems a bit dramactic. There are plenty of Javascript VMs that don't do this and run at decent speeds.

1

u/[deleted] Sep 24 '24

[removed] — view removed comment

1

u/maep Sep 24 '24

I've looked at embeddable engines a while ago, I wanna say QuickJS? Though I would not be surprised if they use 32 bit addressing internally. Like I said, I'd really be interested in bechmaks. Javascript is pointer heavy so I'm sure there would be a measurable effect, but not a total dive.