Why Garbage Collection Paranoia is Still (sometimes) Justified
prog21.dadgum.com
prog21.dadgum.com
Oh, why could that possibly be. Hmm...
- Java: Sun
- Objective C: Apple
- .Net: Microsoft
Big companies with the manpower and determination to make improvements to their platforms. All the other languages have either grown out of one-man prototypes or academic projects. Building a good garbage collector is hard. It's difficult because you can't keep track of much data while you're allocating, you can't walk the graph of allocated objects because different threads are modifying the graph while you're working on it. When you then add a constraint that you can never stop the world for more than 5ms at the time it becomes a Difficult Problem.
Languages like Ruby, Python, Lisp and Scheme don't have good generational garbage collectors because they don't have the manpower to tackle Difficult Problems. (See for instance the global interpreter lock in Python. It's been 10 years now?)
To tackle a Difficult Problem you need (a) a few smart people and (b) get them to work on the problem for many consecutive hours for many consecutive days. Volunteers just can't afford to spend 50+ hours a week for half a year on a problem. A hundred people can chip in weekends and evenings for a year and make no substantial progress at all.
This is completely different from the hypothetical "sufficiently smart compiler" that is supposed to sense the intent of the programmer and optimize accordingly. A sufficiently smart compiler cannot compensate for bad algorithm design, so the performance differences will always be in the margins. The state-of-the-art in terms of garbage collection is decades ahead of what we see in Python, Ruby, Haskell, Scheme and so forth. The GC problem is simple: spread the computational overhead of garbage collection evenly so that the application doesn't stutter. Simple engineering problem with a concrete and clear goal. Just difficult to implement.
It seems that you confused language with implementation. For example: want a Ruby without GIL and with great garbage collector? Use JRuby (and this assumes we are comparing to the official one: YARV). One language, different implementations.
Which leads me to wonder - WTF ever happened to Parrot? I know the project is still alive, but why doesn't anyone seem to be using it?
I've tried implementing Python3 on it for GSoC and failed.
It's hard to do this without hardware support, and even harder on a multiprocessor. Still, I do recall seeing a paper presenting a fully incremental GC with a very short maximum-pause guarantee. The problem was (IIRC) that it made such heavy use of CAS (compare-and-swap) instructions that the overhead of these would be unacceptable.
I wonder how much effort Intel and AMD have been putting into making CAS faster.
However, in 2011 I think that the vast majority of software programmers write would benefit from garbage collection more than they would lose.