3 ms·
So Ruby objects occupy 40 bytes each, inside pages on the eden heap. That's pretty huge. That's several times larger than some other dynamic languages -- langu
by stcredzero 13y ago
So Ruby objects occupy 40 bytes each, inside pages on the eden heap.
That's pretty huge. That's several times larger than some other dynamic languages -- languages that have essentially the same features as Ruby.
- riffraff 13y agoI have no idea of the size in other language implementations, but notice 40 bytes is on x86-64, on 32 bit it's either 20 or 24.
- phamilton 13y agoNot really. Python primitives are smaller (24 bytes). Python strings are 37 + 1 byte per character. Python objects are 72 bytes. Python classes are 104 bytes. (Got these numbers playing around with sys.getsizeof in the python console.) Primitives are a bit bigger in ruby, but they aren't really primitives anyway (everything is an object).
- stcredzero 13y agoPython is another offender!
- phamilton 13y agoWhat languages are you referring to than? Perl and PHP are really the only others that are sort of in the same class as Ruby and Python.
- stcredzero 13y agoSmalltalk, for one.
- rurban 13y agoPerl objects are even bigger and need one indirection per access. A perl head is 32 bytes plus 48 byte body, ie. 80byte on 64bit systems. For my perl rewrite p2 I need one single word per object on the stack. Common Lisps usually needs two words, the class pointer and the tagged value. I really liked the visualization of the various GC's btw. Excellent work!