Copland 2010 revisited: Apple's language and API future
arstechnica.com
arstechnica.com
There's just no easy way forward out of the swamps of C-level memory management that doesn't break the world in some way. Even turning on GC (as we have under OS X) isn't a panacea: there are plenty of Core Foundation kinds of calls that don't participate automatically in GC (you have to manually connect each such allocation to GC). And with "unmanaged" pointers at the C/Obj-C/C++ level, you'll always have to step gingerly around GC.
And he's right to think ahead 5-10 years and realize that we're probably not going to be doing manual memory management then.
So what's the way over the chasm? I don't think anyone really knows, even at Apple.
Perhaps (pure speculation) the MacRuby efforts are part of a back-up plan to see if a ("managed" by definition) dynamic language could help bridge the gap without breaking the world. The MacRuby compiler claims performance on a par with Obj-C or better (using LLVM).
It'll be interesting to see how this plays out.
Yes, I'd also love to see JS become "the next step" (since it seems to be becoming the "machine language" of the future) but it would probably have to be augmented like Objective-J to make Cocoa (Touch) development plausible.
I actually hadn't looked too closely at MacRuby. It is quite an achievement, but compared to (particularly) Lua it's just not fast enough. Compare that to LuaJIT and the differences are remarkable. If MacRuby could be made as fast as Lua then I'd be all for it, I just don't think it's possible given the language semantics.
I guess what I'm saying is that the idea of a dynamic language like any of Lua, Ruby, Javascript, etc. . . being the default systems language on iOS and Mac OS would be amazing; I just don't like Ruby's chances when paired against the other two.
Might I suggest that you do so?
...but compared to (particularly) Lua it's just not fast enough.
I beg to differ; Here's why: http://christopherroach.com/2010/01/21/ruby-fibonacci-shooto...
I just don't like Ruby's chances when paired against the other two.
I do. JS might give it a run, with WebKit also being Apple-sponsored. But, there's no Apple-sponsored Lua implementation. And JS from WebKit doesn't have any sort of (easy to use) way to access Cocoa, like MacRuby does (with HotCocoa).
Apart from using suboptimal Lua code (the author obviously doesn't know about the Lua keyword 'local'), LuaJIT beta2 didn't compile recursion at all. It runs more than 4x faster with the current version and beats MacRuby easily.
Oh, and comparing language implementations based on the speed of a recursive Fibonacci number generator has exactly zero real-world relevance. Try again with a more realistic mix of benchmarks or something domain-specific like SciMark (LuaJIT is only 30% slower than GCC on this one).
Judging from http://antoniocangiano.com/2010/05/16/benchmarking-macruby-0... MacRuby plays in the same league as the other Ruby implementations. And http://shootout.alioth.debian.org/u32/benchmark.php?test=all... tells you where that league can be found, relative to LuaJIT. Hint: scroll to the bottom. :-)
The issue with Ruby is that the things that make it so nice (all of the great object model and meta-programming additions) also bring a certain level of overhead. If it was such a simple task to optimize then the MagLev guys would have produced a kick ass speedy Ruby years ago, based on all of the things that they know about Smalltalk VMs. That said, if Apple has the resources to make MacRuby as fast as Objective C then holy crap; I'd be on that like white on rice.
I don't believe for a moment that Apple would ever use Lua as their systems language of choice; more that I personally thought it would be a great pick. As much as I love Ruby I seriously doubt that Apple would ever be able to squeeze the required performance out of it; the language itself is the problem, not the implementation. Look at all of the work that's gone into producing fast Ruby VMs over the last several years . . . Really, there's low hanging fruit out there and Ruby just doesn't make sense in this context.
And when we follow the link to Peter Cooper's comment...
"I decided to give it a go with MacRuby in its regular interpreted mode (which performed well against 1.9.1 in the fib test) and binary-trees gobbled up 3GB of RAM just in the first minute so I cancelled..
pidigits came in at 41.4 seconds on MacRuby (nightly) versus 30.1 seconds for 1.9.1.
On a reduced version of the fannkuck benchmark (using an input of 10 - otherwise it takes a lonnng time to run), MacRuby was 26.038 seconds, 1.9.1 was 24.277 seconds.
So it seems MacRuby being faster than 1.9.1 is hardly a wash at this point, though it shows great potential to eventually beat the 1.9 branch. "
For what it's worth, we do know, however, that .NET technology is an important component of all games made with Unity.
I've been doing development with .NET/C# for the first time for the last six months and I was surprised to see that the default mode for development is unmanaged. Do any big apps actually use managed mode?
I was surprised to see that the default mode for development is unmanaged.
I find myself wondering what you mean by "default mode", as during the last 9 solid years of .net development work I have found it to very much be the case that managed is the default.Can you clarify your statement?
I could be mistaken, of course; I'm not an expert at .NET yet.
Apple's language and APIs weren't the problem in the days of Copland. It was the kernel/Core OS.
I'm not sure the case of the sky is falling can be made at this time...to do so you'd have to first argue that Unix is dead/on its way out.
It's hard for me to believe that he hasn't heard of MacRuby, but if he had, how could he not mention it in the article.
MacRuby could be a great answer to a lot of the issues he brings up.
What is the difference between the two kinds of memory, and why isn't more RAM added? Is it a cost problem? a size problem? both? Or is the CPU not capable of addressing more RAM...?
I believe Android uses a similar scheme: virtual memory but no pagefile. Is there a way to turn on paging on Android?
It just seems like a really bad article for Ars Technica. This line in particular makes no sense "Nevertheless, Mac developers and users are not panicking like they did in the Copland era about memory protection and preemptive multitasking.". Garbage Collection = Memory Protection ... what the?
As for your second claim, I really don't follow. Memory protection has nothing to do with garbage collection in that quote. He's talking about protected/per process address spaces.
There's absolutely no such outcry, though, among Mac OS X or iOS users for widespread use of garbage collection, and why would there be? In general, Mac/iOS users think of their apps as being more pleasant to use than those on other systems already. I think Siracusa's mistake is in assuming that just because a managed system is inevitable (how much retain/release do you think will be done in 25 years? obviously nearly none) that this means that the benefits of GC are so great as to be a make-or-break... in actuality, the benefit of GC in practice seems to be more on the order of having a nice framework or two built-in.
(keep in mind that was written in 2005)