Apple & GCC

Egh, I've gotten a bunch of emails about while I'm so rabid regarding Apple and compilers. Since I have no burning desire to actually fix stuff on this site (uh, like the comments) at the moment so that they aren't so ugly, below is an explanation of why I am so rabid about Apple and compilers.

Plus, it saves me having to email it to 15 people. It's a little long, but fairly easy to read... but after reading it you should have a fairly good understanding of why I'm so annoyed. If I'm wrong on anything, please let me know.

To begin simply...

The compiler is what turns human readable programming languages (c, c++, objective-c, java, etc) into code that the computer can understand... how optimized that code is for the processor architecture and how wisely it makes use of the resources of the machine drastically affect performance- with OSX only more so... with something like the itanium, it's make-or-break.

To give you an idea, Linux users have already had to go through this years ago... they use GCC (an open source compiler) and Linux was feeling the burn compared to windows. Over time it has become heavily optimized for x86 (more-so than any other platform), to the point where it really is a decent compiler for that platform (though they're still improving it).

That said, it's ~30% slower than Intel's commercial compiler for run-time code. In other words, take an x86 app, run it through GCC and then Intel's compiler and the program using Intel's program will often be about 30% faster as it uses the architecture better.

GCC for PowerPC is pretty brain dead at the moment, but Apple has to use it as it's the only thing out there that understands objective-c (cocoa). It goes something like this:

  1. Apple announces PowerPC. IBM has an AIX compiler, but it's pricey. Around the same time, Apple announced an initiative with symantec to create mrC, a heavily optimized PowerPC compiler. This is a big deal, as Apple is going from CISC to RISC.
  2. PowerPC launch time comes around, and Apple is way behind with their compiler... it's fast as _hell_, kicking ass and taking names against anything else out there (prolly still) but doesn't quite work correctly and really can't be shipped. Enter metroworks, with a native powerpc compiler who really saves Apple's ass. In spades. Can't be stressed enough.

    From this point on, Metroworks (or powerplant) becomes the de-facto IDE for the mac.
  3. Around this time, MrC dies as does the whole Apple/Symantec partnership. A lot of Apple partnership were doing that in these days... ;) Metro's powerplant wasn't the best, but it was reasonably good, although many companies (Apple, Adobe, etc) would use IBM's AIX compiler for a lot of things as they needed the speed boost.
  4. Enter OSX, and openstep being shoe-horned into OSX. Openstep has _always_ primarily been a CISC operating system, going from moto chips, but by the time Apple picked them up they'd primarily been on x86 for 3-4 years or so (from memory). Large parts of everything are in obj-c, and the only thing that really understands obj-c at this point is GCC as Apple is really the only large user of it (or medium sized, or possibly small).
  5. GCC is remarkably brain dead when it comes to PowerPC, as well not a lot of open source people use PPC, and _especially_ not many of the uber-elite people I wish I was half as smart as. How brain-dead?

    Um, well, pretend for the sake of this that a 1GHz PPC is as fast as 1GHz pentium, both running identical versions of Linux and both using GCC. The 1GHz PPC will actually have the speed of a 700MHz PPC. IE, GCC compiled code for x86 is roughly 30-32% faster. On x86, the same code using intel's compiler is often ~30+% faster. Hence, you take a 30%, or the PPC has to be inherently 30% faster than the same x86 hardware for stuff to feel/run the same using linux.

    Apple was able to improve compile times (how long it takes your code to be optimized and turned into stuff the comp can understand) by a factor of 2-3 within one release.

    In other words, if GCC was up-to-par with x86 GCC, and you could magically recompile your OS, things would pretty much run code ~30+% faster. With a heavily optimized best-of-breed compiler that really took advantage of the PPC, Apple could probably get 40-70% improvement. I don't know about you, but it pisses me off a little to be running hardware that could be _that_ much faster. Hence, the rabidness.

  6. The current state is a little muddied, as no one has any real incentive to optimize GCC for PPC except Apple, and IBM to a much smaller extent as AIX is used for much of their higher-end PPC stuff while they push Linux hard they mostly push it on x86 offerings.

Apple sort of has their hands full, as they have to do 2 things:

  1. Since they're the only ones using obj-c, they're pretty much responsible for the entire side of it. Maintaining it, making sure it works correctly from release to release, improving the language, etc. This also affects (ii), as a compiler really has to evaluate 2 parts- what it thinks you're wanting to do and how to best do it on the system you're targeting. Hence, Apple is the only one really telling the compiler how to interpret cocoa stuff.
  2. They're pretty much responsible for getting PPC GCC more optimized as there aren't cheap linux boxes out there running PPC, in which case lots more people would be. This includes (i), plus generating better runtime code and also compiled code performance.

There have been rumblings that Apple has hired some of the old mrC team, so we could be in for some real improvements... but whether or not they put the resources behind it to make it shine is unknown, and it'll be a little out.

Of course the compiler problem has been compounded by Apple shipping so many different configurations- do you optimize for the machine to have an L3 cache? Or a 1meg cache? Or 2meg? Dual or single processor?

Intel has learned that lesson, it's one of the big reasons for pushing hyper-threading. If/when Intel starts pushing dually's on the average desktop, or goes to quads, or even multi-core CPU's there are going to be a ton of apps that will use it better due to increased threading to optimize for hyperthreading. Apple seems to decide when to release generations of dual boxes willy-nilly.

Hell, I know I won't believe Apple won't be possibly transitioning to x86 until they optimize the hell out of mach for RISC & not CISC...

yummy alcohol posted button  posted on July 07, 2003 at 07:24 PM
»  Comments (0)     » Link


Independance Day

Family stuff for the evening... baseball game, fireworks. I still can't bring myself to care about baseball, but it's hard to go wrong with beer, hot dogs and peanuts.

Since it is the fourth, I got through a few chapters today of a Ben Franklin biography I picked up a bit ago but haven't had a chance to really enjoy... the chapters I've read I've loved though. I felt a little guilty, as I meant to reread a few bits of the Adam's biography I have but instead spent it reading

yummy alcohol posted button  posted on July 05, 2003 at 12:40 AM
»  Comments (0)     » Link


Hydra weirdness

I've been using Hydra a lot lately, which is an uber-cool editor with emacs-style sharing via rendezvous. Today for some reason the 1.1 build is really going wonky... which is annoying me to no end, as 1.1 has some things in it (syntax coloring for more than C) that I really need to use.

IE, the tool bars and syntax options have gone away entirely. I've cleared my caches, rebooted, repaired permissions... but no Hydra love. It looks something like this:

HydraScreenSnapz001.jpg

yummy alcohol posted button  posted on July 03, 2003 at 01:27 PM
»  Comments (1)     » Link


NASA G5 study

This came across my desk last night at about 3am and I just now got a chance to really go through it. It's a comparison of the new 2GHz G5 processor to the older G4 and X86 Xeon's.

For the purposed of comparing the G5 to the xeon, it pretty much fell out as I thought it would considering the compiler issues and the G5's fairly nascent architecture.... especially considering the types of tests being run.

What I found most interesting was this:

Benchmarks from the scalar version of Jet3D are shown in Figure 1 (MFLOPS) and Figure 2 (MFLOPS normalized by MHz). In terms of raw MFLOPS, the 2GHz G5 is about 32% faster than the 2GHz P4, 97% faster than the 1.25GHz G4, 142% faster than the 1GHz G4, and within 1 MFLOP of the 2.66GHz P4.

I really hated Apple's 1.25GHz & 1.42GHz towers, they just weren't good machines compared to the 1GHz machines. Too many tradeoffs just for the MHz, and this sorta shows that off.

If clock speeds were equal, these machines would do a good job of stomping on the Xeon's. There's supposed to be a 3GHz G5 part shipping within a year, but by next July Intel really should be shipping a 4GHz+ part. It'll still narrow the race somewhat, so it should be interesting.

yummy alcohol posted button  posted on July 03, 2003 at 12:50 PM
»  Comments (0)     » Link


Cassedy & Greene (aka, the author of Mac Night Owl is a hack)

You know, I don't really read Mac news sites by and large. They're often run by people who love Apple products, but for the most part don't really know anything... hence the sites & forums of those sites often turn into narcisistic, apologetic and uninformed circle-jerks. There are much better places to get good, reliable info.

So, I miss a lot of the really stupid articles... but I've had this one forwarded onto me from two people and it's annoying the hell out of me. I rarely would refer to anyone as a reason-challenged hack, but Mr. Steinberg gets the honor. The only saving grace seems to be that not many people really know who he is or read his site... hence, he seems to post really nonsensical stuff with misleading headlines hoping to get linked to from other mac news sites, and hence push up his ad impressions.

This "article" is a very good example, the title is barely applicable to the article, just a bit sensationalistic over, well, nothing. Bygones, actual news sites usually do that sort of thing too... but the "article" itself is barely coherent in that it contradicts itself several times which you can see by just giving it a quick overview.

However, these two paragraphs struck me particularly vile:

The demise of C&G doesn't auger well for small software companies. It's hard enough for any small business to survive in an uncertain economic climate. And finding a niche that won't be usurped by a larger company, even Apple itself, is doubly difficult.

The point being in that somehow Apple is pushing out smaller software companies by including new "features" in their OS, such as font management, reminiscent of what some people think happened with Watson (a whole other story, which I think Watson's creator milked a lil too much considering his entire app was based on calls Apple put into the system saying "this is what you can do").

Anyone who does print work using a mac uses some sort of font management tool. Macs have an extremely high marketshare in the print market... hence, it's a feature many people need/want. It just makes sense, and should have been in 10.1. There isn't a whole lot in OSX that really makes a print designer go "oOoooOo that would help me", but this feature is one of them. Good for adoption, good for users, good all around.

Being a small software developer (or small anything) is about identifying and exploiting niche markets. If the one you're currently exploiting is going the way of the do-do, you either have to identify a new niche. If that isn't possible, or you can't compete, you close up shop.

For example, you could claim that by including Apache in a stock OSX config that Apple has completely stolen the mac web serving market from the likes of webstar. Or that by including mySQL they'd be doing the same to filemaker (which is an Apple subsidiary), or by including a spell checker at the OS level they've doomed the market for 3rd party spell checkers, or by including anti-aliasing of text they'd killed that market off...

...or that by including an integrated TCP/IP stack they've killed the market for 3rd party TCP/IP stacks. Sounds kinda stupid, doesn't it?

But how has Mac OS X hurt Casady & Greene? Well, let's face it, the need for Conflict Catcher, probably one of the showpieces in the company's line, has all but been eliminated. Yes, it still runs in the Classic environment, but as more and more Mac users move full time to Mac OS X, even that becomes irrelevant.

This one is just so blatently stupid... the market for their product simply went away because it was tied to a product that also went away. It happened to be their main livelihood, so their company went away. The gist goes something like this:

OS9 and below used 'patches' to the operating system at boot time called extensions, which allowed companies to extend what the OS did, or even to change it's functionality.

Often times these extensions would "conflict" with each other, and to track down the problem you were in for a lot of grunt work: disabling an extension, restarting and seeing if the problem still occurred. If it didn't, you knew you were on the right track. Conflict catcher simplified the process immensely. It wasn't necessary, you could do it all by brute forcing it very easily, but conflict catcher did simplify things greatly... hence it had a pretty brisk business. With OSX, the whole underlying OS changed dramatically, hence there isn't a need for conflict catcher anymore.

To give Apple any guff over this is, well, stupid. Looking at the rest of Casady & Greene's product line... there just isn't anything there really relavant anymore. There's nothing that anyone really wants.

Looking at OSX... it's immature. There are all sorts of things users do want, which other companies have identified and are selling... and hence, making some $$$. This particular company chose not to compete, and hence is gone... it's sad, but that is just how it works... no company (including Apple) is immune.

yummy alcohol posted button  posted on July 01, 2003 at 08:51 PM
»  Comments (1)     » Link