When will Java go mainstream like Python?

Lie Ryan lie.1296 at gmail.com
Thu Feb 25 13:27:03 CET 2010

On 02/25/10 07:40, Wanja Gayk wrote:
> Am 24.02.2010, 00:22 Uhr, schrieb Lawrence D'Oliveiro
> <ldo at geek-central.gen.new_zealand>:
>>> Java - The JVM code been hacked to death by Sun engineers (optimised)
>>> Python - The PVM code has seen speed-ups in Unladen or via Pyrex..
>>> ad-infinitum but nowhere as near to JVM
>> Python is still faster, though.
> In synthetic microbenchmarks without any practical importance - possibly..
>> I think a key reason is that its VM supports
>> reference-counting, which the Java folks never quite got the grasp of.
> Reference counting is about the worst technique for garbage collection.

I disagree IMO, assuming there is no circular reference, reference
counting is the simple, lightweight, and best garbage collection
technique. Reference counting can free memory (or return it to cache)
right after the refcount turns zero; other traditional garbage
management techniques runs periodically and there's a delay between
getting to zero reference to actual memory release. The other weakness
of traditional garbage managers is the symptomatic "stopping the time"
whenever the GC is running, which makes it unsuitable for time-sensitive

The only weakness of reference counting is its inability to detect
circular reference, which is why CPython have an additional garbage

> Modern Java VM won't count references. They will just trace the active
> references from the rootand mark all objects it finds as active and save
> these. The remaining ones are garbage. The reason why this is faster is
> that there are usually less live objects than dead ones and there are
> less refereces to look at.

Reference counting is even faster since there is only one object to be
looked at: the object that is being dereferenced. There is no need to
look at other live objects, there is no need to look other dead objects,
just the current object.

More information about the Python-list mailing list