 |
Java on Leopard: The New Rendering Pipeline
Posted by javaben on October 31, 2007 at 09:44 AM | Comments (22)
In my recent duo of "Whiners! No whining!" blog posts, I made a statement with which some commenters have taken issue:
the already-mentioned transition to Sun's rendering pipeline (a tough but correct decision reflecting a commitment to cross-platform fidelity)
Specifically, Michael Urban wrote in to say:
I really don't see how this has anything to do with cross-platform fidelity. After all, Sun JVMs don't even use the Sun pipeline by default anymore. They use the OpenGL pipeline where / when it is available. I think all Apple really did by switching to the Sun pipeline is make Java2D performance unusably slow, and create tons of support headaches for developers who now have to field all the complaints from their customers about why their application no long works correctly on Leopard, and either explain to the customer who to enable the Quartz pipeline, or ship a patch for their application to re-enable the Quartz pipeline.
Michael, as you'll see below, Sun's OpenGL renderer is indeed part of the pipeline Apple is now using. And unless I'm really out of date, I think the traditional GDI platform is still used on the majority of Windows JRE installs.
And "opinali" opined:
but what you said about the transition to the Sun rendering pipeline being an improvement, that was pure spin that I'd only parse as radical Mac zealotry. There is NO justification for this (except Apple having no resources / time / priority to update the accelerated pipeline for the new OS). It's the opposite direction that everybody else is moving; see for example Java 6 UpdateN, which will move to the new D3D-accelerated pipeline by default on Windows. The Java platform must keep up with the LAF improvements of the latest OSs, like Vista and OSX, which are severely raising the bar in sfx (remarkably with WPF, Quartz, Beryl etc) so the Java toolkits (AWT/Swing/J2D) can't reasonably compete without full acceleration. And also, Java must support the development of "filthy rich" clients, not that I like this trend, but many users do so developers should be able to crank out sophisticated J2D effects that don't bring Java's performance to its knees. These requirements are MUCH more important than "pixel-by-pixel portability" (and for this, there's always the option of the portable Java LAF).
Well, look. Dissent on this topic is perfectly reasonable; there are trade-offs at work. But, I'm confident that in the final analysis, most folks will agree this was the right decision.
Let's start with precedent. Initially, Sun relied on the underlying platforms to perform font rendering, but in Java 1.2 a new Java2D-based pipeline was introduced. This pipeline has represented a substantial engineering investment, especially as Adobe font support and subpixel anti-aliasing have come into the picture. Why not just use the underlying platform's font renderer?
The answer, of course, is that it would be nearly impossible to write cross-platform applications that do any detailed layout or typography work without Java itself handling the rendering. Sun abandoned the technically superior rendering approach in most situations in the name of compatibility.
Now, with Quartz, we see shades of the same issue. Quartz is great, Quartz makes certain drawing operations wicked fast in Java, but Quartz is much different than Sun's pipeline. The canonical example of just how different is the fact that aliased lines require Apple's adapter to draw an anti-aliased line (the *only* kind of line in Quartz) and then mask out the aliased pixels. Try some benchmarks to see just how slow this is.
Anyone who has written a rendering-heavy app has run into the pain that these differences cause. Any time the cross platform abstraction breaks and you need to adapt for the underlying platform, Java loses (or, phrased less dramatically, the value proposition of Java leaks in direct proportion to how often its abstractions leak).
Now that Sun has produced an OpenGL pipeline and is committed to making it work, why wouldn't Apple drop their own Java bridge to a Cocoa bridge to OpenGL in favor of Sun's OpenGL pipeline? Sun now pays the tax to make OpenGL behave the same as their traditional GDI (and Linux and Solaris equivalent) pipelines.
Thus, the Apple team no longer duplicates work that Sun is doing and they can spend more time on other features (like porting the new applet architecture to OS X, for example).
There are really only two sets of potential losers here: those who use Java to develop for OS X and don't care about other platforms, and those who need a fully tested and optimized Sun rendering pipeline today.
For the former, I'm convinced it's not a big deal. If you really want to take advantage of OS X goodies, learn Ruby and use the Ruby/Cocoa bridge. If you're content to just look like a native OS X app and don't need really fancy effects, the new Aqua look-and-feel is quite nice and I'm hopeful it will evolve favorably over time.
For the latter group--that need it today--I think you're confusing needs and wants. Use Quartz today and switch to the Sun pipeline when you're ready. In my own testing, it works quite well for most needs.
Am I wrong? Was this move a blunder? I'm curious to hear other points of view.
UPDATE: amasson pointed out that the Quartz stack includes a non-retained mode drawing API. I excised the relevant paragraph. See comments below for details. Thanks amasson!
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
I didn't know that the Sun pipeline, on Mac, was OGL accelerated. Blame on me as I am utterly ignorant of the Mac platform, I supposed we were talking about a software pipeline. I didn't know these issues with Quartz either - I know it's forte is retained mode, composition engine, but I thought it would expose lower-level immediate APIs. In short I thought Quartz (or whatever Mac-specific APIs used by Apple's JVM) would be something equivalent to the full stack of Microsoft DirectX graphics APIs, but it seems it's only a replacement for high-level APIs like Vista's WPF.
On the other hand, if people are reporting that the Sun pipeline suffers massive slowdowns at least in some cases, then Apple should have worked to make this OpenGL pipeline better on the Mac. It seems they have bet the farm in the Quartz pipeline in past versions, then they found that this option had some difficult issues, and backed to the Sun pipeline in a hurry without making the necessary investment to Mac-optimize it. I hope this gets better if/when the Leopard Java6 VM is released, since it should inherit the last significant improvements that Sun has been doing in the OGL pipeline. But much of this is post-UpdateN, which others have "whined" that will probably arrive to the Mac sometime in 2009 if Apple's track record is any indication... I hope not.
Posted by: opinali on October 31, 2007 at 10:58 AM
-
opinali: Some clarifications:
1. I have no idea if the Sun OpenGL pipeline is currently used on OS X. Maybe, maybe not. My point is that I believe a large reason they moved is because its there and they can use in the future. I forget if any comments I may have heard from Apple on this matter are covered under NDA, so I'll leave it at that.
2. Apple announced the move to the Sun pipeline back in '06, and I suspect they have been considering it for a much longer period of time. I don't believe this was a quick after-thought.
3. I would bet the performance of the new Java2D stuff will improve. We're just starting business day 3 since Leopard hit the streets.
Posted by: javaben on October 31, 2007 at 11:47 AM
-
Well, I think we can both agree that compatibility is a good goal. And thank you for your detailed insights on why it is important that it use the Sun pipeline.
However, I think we can also both agree that compatibility doesn't mean a whole lot if achieving it means you broke performance to the point of being unusable. I am not exaggerating when I say Java2D performance is so bad on Leopard without the Quartz pipeline, that it is unusable. It literally is unusable.
If apple wants to make the Sun pipeline the default to be more compatible, that's fine. But they should have waited to do that until after they had made it work with a level of performance that was usable.
As far as whether it is using the OpenGL pipeline, I can probably say for sure it is not. I don't see how the performance could possibly be as bad is it is if were using it.
Posted by: mikeurban on October 31, 2007 at 12:51 PM
-
Mike: I hear you. Keep in mind that *all* Mac developers are reeling from Leopard, whether they be Java or ObjC devs. Many apps are broken across the board. This is par for Apple's course, and I think the majority of users understand. Certainly, my problems w/ Vista have been much, much, much worse.
Let's see how things stand in a month or two before rendering judgment.
As far as the Java2D pipeline, I'm confused. IDEA works great for me, and it doesn't appear to use the Quartz pipeline. My own apps are working fine. Perhaps Apple didn't create a sufficiently large pool of test-cases, though you'd think they would have.
Cheers, Ben
Posted by: javaben on October 31, 2007 at 01:25 PM
-
From the java-dev mailing list (response by Mike Swingler, Apple engineer):
"The OpenGL pipeline is not present in Java 5 for Leopard."
Posted by: fabriziogiudici on October 31, 2007 at 02:20 PM
-
The problem I am having with the Java2D pipeline was not with IDEA. That I think is a different problem and I don't know what is causing that. The problem with the Java2D pipeline is a project I am working on where I use Java2D for image operations such as on the fly scaling when performing zoom functions and such. On Tiger with Java 5, it is totally smooth. It's also totally smooth on Linux and Windows. But on Leopard, without using the Quartz pipeline, it's not even usable.
You might be right that Apple didn't sufficiently test things like animation or image manipulation.
Posted by: mikeurban on October 31, 2007 at 02:23 PM
-
I'm not convinced at all about the move with the pipeline and I'm on the suspicious side. It would make sense if Apple switched to OpenGL pipeline when they are ready to, but they aren't (and not a word if they are going to do in future).
But, above all, I see a lot of comments around the blogsphere and people hasn't probably read the official word by Apple (in one of the rare cases when they say something):
Details are here: http://lists.apple.com/archives/Java-dev//2007/Oct/msg00391.html
It appears that: 1) there are not final decisions here 2) Sun pipeline is used by default BUT Quartz would be used where resolution independence is needed, since Sun pipeline would be unable to deal with that. Given that a lot of new Macs should have monitors with higher resolution, I swear I'm not understandind much here.
Posted by: fabriziogiudici on October 31, 2007 at 02:36 PM
-
fabriziogiudici: Suspicious of what? Sun hasn't finalized their story on resolution independence yet. They are way behind the ball here and poor Apple has to sit on their thumbs until they figure out what Sun is going to do. They did implement a solution for Quartz as an experiment to gather data. What has Sun done? The only data point I'm aware outside of Apple's work in this area is Karsten Lentzch's JGoodies DLU stuff.
I should clarify: by switching to Sun's pipeline, Apple will be able to use Sun's fancy new Java 1.6 OpenGL pipeline. I have no idea if they've back-ported it, will back-port it, or will use it in Java 6.
I'm going to stop checking the comments on these blog postings very regularly now. The points I waned to make were:
Java 1.5 on Leopard does not represent a lack of commitment to Java. Instead of Mike Urban's characterization of a huge leap backwards, it's actually dramatically the opposite in a whole host of ways.
Would those people who are loudly taking Apple to task over not having 1.6 on day one of Leopard please stop whining about it? As another commenter put it, the other JRE licensees are generally even slower than Apple and with Bootcamp / Parallels / Fusion, there are plenty of ways to use Java 1.6 right now. As another put it, Java 1.6 solves a lot of issues required to make Swing decent on Windows. Apple has solved most / all of those issues ("hardware" back-buffering, subpixel AA, etc.) on Java 1.5.
I've made those points repeatedly in a number of ways, and now that the discussion has evolved into more nuanced criticism of Apple's approach to switching Java2D pipelines, etc., I'm heading for the exit. I'm not the right guy to comment on such matters. Fortunately, be assured that while the Java Apple team may be largely silent, they are listening and good people like you and me are at the other end of their opaque feedback orifices.
Thanks all for putting up with my abrasive ranting on this topic.
Posted by: javaben on October 31, 2007 at 02:52 PM
-
> Would those people who are loudly taking Apple to task over not having
> 1.6 on day one of Leopard please stop whining about it? As another
> commenter put it, the other JRE licensees are generally even slower than
> Apple...
I think I am going to have to disagree on that point. IBM and BEA have both had Java 6 out for quite some time now. And neither Bootcamp or Parallels is even an option on PPC Macs of course.
As far as Apple's lack of commitment to Java, I won't even bring up some of the other evidence of that fact (like for example, the fact that it generally takes them months to issue security patches, even for critical holes. There are currently several unpatched security holes , at least some of them of a critical nature in Java 5 on Tiger that have been there for almost a year now.)
No, I don't want to start a discussion on that. But I only use it to point out that I don't think I am being unfair when I say that I am rightfully frustrated with the way Apple has handled Java, and with what in many ways appears to be a lack of commitment from them.
Posted by: mikeurban on October 31, 2007 at 04:41 PM
-
Mike:
1. Here's the latest Java releases from IBM as of today, Nov 1/07:
http://www.ibm.com/developerworks/java/jdk/other/portingplans.html
Notice that the current version is Java 5, everywhere. Java 6 (see link at the bottom) is only in early access, and not for all platforms.
I am unable to locate a NON BETA version of Java 6 from IBM. You state that such an item exists; would you be kind enough to provide a link?
2. And now BEA:
BEA is not a hardware vendor, they are only providing part of Java - the JVM. They do not modify the class libraries as far as I can determine (where most of the Java work is, today). Finally, JVM level changes between Java versions are limited, generally. Bottom line: upgrading JRockit is much less work than upgrading Apple's Java, and thus is not really a fair comparison. Regardless:
http://dev2dev.bea.com/blog/hstahl/archive/2007/04/jrockit_for_jav.html
Here, you are correct - the first Java 6 JRockit implementation arrived on April 4/07.
3. Here's a public statement from Apple on Java 6. Its not a lot, but Apple never gives a lot, and this is a long standing, well known policy. Many people have complained about this to no avail; it may be an unwise policy in some contexts but it is a FIRM policy. Jobs will break this policy occasionally, in front of a suitably significant audience; I don't expect any breakage of the policy around Java 6 Leopard:
http://www.macworld.co.uk/mac/news/index.cfm?newsid=19525
4. As regards security - why are you bringing this up? The topic was Java 6, not security.
Personally, I think Apple does a good, but not perfect job of security. I can, with confidence, recommend OS X for internet use by unsophisticated home users, altho common sense is always important, and sometimes rare.
I do not think that when a security issue arises that certain OS X components get worse service than other components. I do see that some security issues get addressed sooner than others, but I think it is absurd to say that Apple will let the overall platform's security suffer by providing less service to some components (Java) vs. other components, as you suggest.
5. I, too, am disappointed (but not surprised) by Apple's lack of information from time to time. But I know that this is just the way things are. I also know that this isn't a reflection of a lack of a commitment, its just a very firm, albeit sometimes frustrating Apple policy. People who are not aware of this will find this annoying, even enraging, and Apple always gets slammed over this when it comes to Java.
But that's just the way things are with Apple. You like the product(s)? Go for it - they will, generally, consistently delight you with their elegance, design and innovation, from top to bottom. And, feature for feature, are reasonably priced.
Apple products do come with this negative - secrecy/lack of future visibility, however. For consumer devices, surprises are great. For developers and IT, as regards mainstream technologies like Java 6, not so much. For most things signing the NDA and attending WWDC will help. But Apple clearly is not developing in the open in the uppermost layers of their software stack, even with Open Source, GPL'ed technologies like Java.
Glenn
Posted by: ga427 on November 01, 2007 at 08:55 AM
-
Glen,
That was my mistake. The one from IBM is only a beta.
Posted by: mikeurban on November 01, 2007 at 09:45 AM
-
This has to be the most dishonest and unprofessional blog I've seen here at java.net. I sincerely hope that antagonistic blogs where the author is on the verge of flaming the readers does not become the norm here.
Calling those who disagree w/valid technical points "whiners"? Threatening to leave the conversation? How childish is this blog?
Posted by: dirtyqwerty on November 01, 2007 at 12:17 PM
-
dirty: What's the dishonest bit, friend?
Posted by: javaben on November 01, 2007 at 12:25 PM
-
The name calling is very unfortunate, but a sad reflection of the state of discussions on the internet.
Posted by: augusto on November 01, 2007 at 02:20 PM
-
augusto: Yeah, calling people whining about Java and Apple "whiners" is really a sad, disgusting thing to do. I'm deeply ashamed.
Posted by: javaben on November 01, 2007 at 02:54 PM
-
Nobody is "whining", is it really that horrible to see consumers of a product frustrated by complete lack of communication and clarify???
It's also very disturbing to see the amount of people who are in total acceptance of companies not communicating clearly or at all with their customers.
Posted by: augusto on November 01, 2007 at 03:07 PM
-
augusto: As I've said before, I'm not defending their PR practices, friend. I'm defending the quality of JRE 1.5 on Leopard and the fact JRE 1.6 didn't ship with Leopard. And my defense is measured, right? It's "Hey, maybe you shouldn't say that clearly Apple has dropped support for Java and it's time to get a different OS because Java on 10.5.0 has a few bugs, significantly more features, and 1.6 isn't ready yet."
Despite restating that point in a large variety of ways, folks keep reverting back to "Apple's secrecy is bad! Bad! Bad!" Meh. It is what it is. I dislike it myself, but that's life with Apple.
On a conciliatory note, I agree with you that a posture of "Hey guys, maybe you're wrong to get so upset about Java 1.5 and Java 1.6 on Leopard" would have been more productive, but, much less fun.
Every time a new version of OS X comes out, and every time Sun releases a new JDK, the same tired meme cycles around: "Apple sucks! I'm ditching my Apple! Open source rules!" For those of us who think this is not an entirely rational position, it does indeed seem whiney.
But seriously, my sincere apologies if labeling such folks as whiners offends you in some deep way you are unable to shrug off without a second thought.
How about "complainers"? "Belly-achers"? "Grumblers"?
In any event, I'm probably very wrong about the marketplace accepting Apple's policies and the Mac is probably going to be overtaken by desktop Linux and Solaris any year now. Or perhaps Apple will ditch their JRE and Sun will be forced to either support the Mac or maybe Apple will pull a Darwin/WebObjects play and make some key aspects of the Java stack tied to open-source projects.
It is a little unsettling for Java developers to notice that, outside of little developer tools, there haven't been a whole lot of Java apps written for the Mac. No "A-class" Java apps have emerged. And since the Mac hasn't made big enterprise in-roads... why are they supporting it again? Applets? Oh wait, no, those didn't catch on.
So it is a bit fortunate that Apple has supported Java as long as they have, and it's not clear to me as an amateur outside analyst that they get what they give in this department. I know I'm grateful they continue to produce and support a top-notch JRE. This is an area I'm probably way wrong on--they may indeed have a large number of customers who are dependent on Java support for the Mac.
In any event, your comment reply to my comment was certainly nicer than I thought you would be after my deeply sarcastic retort to your leap to the moral high-ground by associating my remarks with all that's bad in web debate. For that, I thank you.
Best wishes, Ben.
Posted by: javaben on November 01, 2007 at 03:19 PM
-
"Don't forget that Quartz is a retained drawing API whereas Java2D is non-retained..."
No, Quartz 2D is not retained, like Java2D (and OpenGL, GDI, ...), and unlike WPF or SVG.
Of course Quartz Compositor (the window manager) bufferizes window contents, but no graphic tree is retained, only bitmaps.
I think non-retained (pipelined) API are better (remember QuickDraw 3D or Direct3D retained mode).
Posted by: amasson on November 02, 2007 at 10:07 AM
-
amasson: Jeepers, you're right! I confused Cocoa's drawing API with Quartz 2D's API, and given the Quartz pipeline's really weird painting behavior (flickering, other painting glitches), I attributed this to issues with clearing the retained canvas on repainting.
Terribly sloppy of me to jump to that conclusion. I did have someone much more knowledgeable on these matters than I review the blog entry, but obviously it's my fault. Sorry!
Posted by: javaben on November 02, 2007 at 10:23 AM
-
Well said, Ben.
The problem I am having with the Java2D pipeline was not with IDEA
I correspond regularly with Apple JDK developers, and I've seen no indication that work on Java 6 has stopped or anything like that - some of the rancor around this is legitimate, and some of it is "making news". Just yesterday I got a question from an Apple engineer about a rendering glitch in NetBeans with a proposed fix for it. I suspect the elephant in the room here is Steve Jobs comment re the iPhone about Java being a ball and chain. I didn't love hearing that either, but 1. he was talking about a phone not a desktop, and 2., Apple has some smart people and I suspect good sense will carry the day.
Anyone who has ever tried to do push-painting on Mac OS (i.e. call Component.getGraphics() and draw, rather than rely on the repaint manager to do timely updates - never a great practice but sometimes useful for sophisticated drag-and-drop feedback on the glass pane) knows the pain of the differences between drawing on Mac OS and anywhere else - theres a raft of mac-specific code in the NetBeans window system I'd love to delete and probably could once one can rely on there being more cross platform painting consistency.
I'm frustrated that there is not yet a real JDK 6 for Mac too, but all in all, Ben is right - the things Apple is doing are a blessing long-term.
Posted by: timboudreau on November 04, 2007 at 09:12 PM
-
lotro gold
lord of the rings gold
lord of the rings online gold
lotro gold
lord of the rings gold
lord of the rings online gold
Warhammer gold
Warhammer online gold
Warhammer money
War gold
War money
Tabula Rasa Credit
lotro gold
lord of the rings gold
lord of the rings online gold
lord of the rings online gold
lord of the rings gold
Tabula Rasa Credit
World of Warcraft gold
PotBS Doubloons
Pirates of the Burning Sea Doubloons
PotBS Gold
Pirates of the Burning Sea Gold
lotro gold
lord of the rings gold
lord of the rings online gold
Tabula Rasa Credit
Warhammer gold
Warhammer online gold
PotBS Doubloons
PotBS gold
Age of Conan gold
Age of Conan gold
Pirates of the Burning Sea gold
Pirates of the Burning Sea Doubloons
Warhammer gold
Warhammer online gold
Age of Conan gold
PotBS Doubloons
PotBS gold
Pirates of the Burning Sea gold
Pirates of the Burning Sea Doubloons
Posted by: huang_lar on March 16, 2008 at 12:54 PM
-
Yeah,every time a new version of OS X comes out, and every time Sun releases a new JDK, the same tired meme cycles around: "Apple sucks! I'm ditching my Apple! Open source rules!" For those of us who think this is not an entirely rational position, it does indeed seem whiney.
---
Digital Picture Frame
Posted by: kyes on May 21, 2008 at 07:32 AM
|