discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objective-c: how slow ?


From: Chris Hanson
Subject: Re: objective-c: how slow ?
Date: Sun, 2 Sep 2001 15:42:57 -0500

At 3:00 PM -0500 8/31/01, Erik M. Buck wrote:
I personally have never seen Java perform even half as fast as Objective-C.
Every Java program I have used on the desktop suffered from slow buggy
graphics and was prone to occasional halts/freezes presumably while garbage
was collected.  Every Java implementation that I have seen as suffered from
a large memory footprint for the VM and then problems resulting from the
heap size not being large enough (Java heap sizes are limited for security
so that a Java program can not crash a machine by allocating too much
memory: (This is a job of the operating system and not a language, but what
can you do ?)

Just as an aside, Apple has claimed that for equivalent code on the same hardware and OS (Mac OS X 10.0.x), a 100% Java WebObjects 5 application will perform better than an Objective-C

I have not seen this in the real world (though I haven't done any comparisons), and I don't doubt the validity of Erik's real-world observations.

What I have seen the real world are Smalltalk implementations with *excellent* performance on ancient hardware. QKS SmalltalkAgents had a full virtual machine architecture, full dynamic messaging, full garbage collection, etc. and performed so well on a 25MHz 68040 with 12MB of RAM that a normal end-user application developed in SmalltalkAgents didn't differ in "feel" from a native Macintosh application. It's an existence proof that something *like* Java can be done well. (Sadly, QKS was just a little before their time. They tried to make their "Agents Operating System" VM portable and license it to vendors in the early to mid 1990s, before Java and without Sun's marketing muscle. It was a great idea, it's too bad they weren't successful. At least they're still around!)

Apple and Connectix have also provided existence proofs that virtual machines don't have to be slow. The 68040 emulator that's part of the Mac OS was fast enough on the original Power Macintosh hardware (60MHz PowerPC 601) that Apple didn't have to rewrite their device drivers for the PowerPC. The second-generation "dynamic recompilation" (JIT) emulator ran 68040 code faster on a 1995-era PowerMac than any 68040 released to that date. Connectix Virtual PC 4, whose emulator was written by the same wizard as Apple's second-generation 68040 emulator, performs well enough on a 400MHz G3 that I can run QuickBooks Pro on Windows 2000 and it feels like a 233MHz Pentium.

There's no reason Java has to be slow -- that it is says more about Sun than it does about languages running on virtual machines, or about garbage collection, or about dynamic languages.

  -- Chris

PS - The question shouldn't be "Objective-C: How slow?" but rather "How fast?" After all, Objective-C is native code and uses manual memory management. True dynamic dispatch also tends to have better branch-prediction behavior on modern processors than C++ virtual function dispatch. (Search comp.lang.smalltalk for a URL to the paper describing this discovery. As instruction pipelines get deeper, this will become even more of an issue.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]