new principle of division between structures and classes
Weed
resume755 at mail.ru
Sun Jan 11 01:02:32 PST 2009
Weed пишет:
>>> 4. Java and C# also uses objects by reference? But both these of
>>> language are interpreted. I assume that the interpreter generally with
>>> identical speed allocates memory in a heap and in a stack, therefore
>>> authors of these languages and used reference model.
>>>
>> Neither of these languages are interpreted, they both are compiled into
>> native code at runtime.
>
> Oh!:) but I suspect such classes scheme somehow correspond with
> JIT-compilation.
>
I guess allocation in Java occurs fast because of usage of the its own
memory manager.
I do not know how it is fair, but:
http://www.ibm.com/developerworks/java/library/j-jtp09275.html
"Pop quiz: Which language boasts faster raw allocation performance, the
Java language, or C/C++? The answer may surprise you -- allocation in
modern JVMs is far faster than the best performing malloc
implementations. The common code path for new Object() in HotSpot 1.4.2
and later is approximately 10 machine instructions (data provided by
Sun; see Resources), whereas the best performing malloc implementations
in C require on average between 60 and 100 instructions per call
(Detlefs, et. al.; see Resources)."
Therefore they do not worry concerning performance of creation of
objects in a heap and reference classes for them approach.
More information about the Digitalmars-d
mailing list