Sun heeft donderdag een preview gepubliceerd van Javafx. Met deze programmeeromgeving hoopt Sun een gedeelte van de markt voor rich internetapplicaties voor zich op te eisen.
Als ontwikkelomgeving staat Java natuurlijk al jaren op de kaart. Voor de toenemend populaire ria's moet Sun echter Flash van Adobe en sinds kort Silverlight van Microsoft laten voorgaan. In een tijd waarin de grens tussen desktop- en internetapplicaties steeds verder vervaagt, kan Sun het zich echter niet veroorloven zijn concurrenten een te grote voorsprong te laten nemen.
Op het Javaone-evenement kondige Sun de komst van Javafx aan en inmiddels is er een preview van de sdk te downloaden. Deze sdk bestaat uit het framework, een compiler, versie 6.1 van de NetBeans-ide en uitgebreide documentatie en voorbeelden. Ook is er een versie van Project Nile bij de sdk ingesloten. Deze software omvat een aantal plugins voor Illustrator en Photoshop waarmee grafische ontwerpen eenvoudig geëxporteerd kunnen worden, zodat ze in Javafx kunnen worden gebruikt. De sdk is gedurende 60 dagen te gebruiken.
Het Javafx-platform beschikt over verschillende runtimes waaronder een voor de desktop, een voor mobiele applicaties en een voor tv-achtige apparaten. De desktopversie zal in het najaar van dit jaar beschikbaar zijn terwijl tot de lente van 2009 op de mobiele versie gewacht moet worden. De tv-versie is pas in de loop van 2010 te krijgen.

Dit citaat geeft een specifiek voorbeeld hoe een JIT aan de hand van runtime informatie een methode-aanroep beter kan compileren.Here's one example. C is really fast, because among other things, the compiler can inline function calls. It's gonna use some heuristics, so it doesn't get too much code bloat, but if it sees a function call, it can inline it: it patches it right in, ok, because it knows the address at link time.
C++ — you've got your virtual method dispatch, which is what C++ you know, sort of evangelists, that's the first thing they go after, like in an interview, "tell me how a virtual method table works!" Right? Out of all the features in C++, they care a lot about that one, because it's the one they have to pay for at run time, and it drives them nuts! It drives them nuts because the compiler doesn't know, at run time, the receiver's type.
If you call foo.bar(), foo could be some class that C++ knows about, or it could be some class that got loaded in afterwards. And so it winds up — this polymorphism winds up meaning the compiler can compile both the caller and the callee, but it can't compile them together. So you get all the overhead of a function call. Plus, you know, the method lookup. Which is more than just the instructions involved. You're also blowing your instruction cache, and you're messing with all these, potentially, code optimizations that could be happening if it were one basic-block fall-through.
[...]
In particular, let me come back to my inlining example. Java inlines polymorphic methods! Now the simplest way to do it was actually invented here at Stanford by Googler Urs Hoelzle, who's, you know, like VP and Fellow there, and it's called, it's now called Polymorphic Inline Caching. He called it, uh, type-feedback compilation, I believe is what he called it. Great paper. And it scared everybody, apparently. The rumors on the mailing lists were that people were terrified of it, I mean it seems too hard. And if you look at it now, you're like, dang, that was a good idea.
All it is, I mean, I told you the compiler doesn't know the receiver type, right? But the thing is, in computing, I mean, heuristics work pretty well. The whole 80/20 rule and the Power Law apply pretty much unilaterally across the board. So you can make assumptions like: the first time through a loop, if a particular variable is a specific instance of a type, then it's probably going to be [the same type] on the remaining iterations of the loop. OK?
So what he [Urs] does, is he has these counters at hot spots in the code, in the VM. And they come in and they check the types of the arguments [or operands]. And they say, all right, it looks like a bunch of them appear to be class B, where we thought it might be class A.
So what we're gonna do is generate this fall-through code that says, all right, if it's a B – so they have to put the guard instruction in there; it has to be correct: it has to handle the case where they're wrong, OK? But they can make the guard instruction very, very fast, effectively one instruction, depending on how you do it. You can compare the address of the intended method, or you can maybe do a type-tag comparison. There are different ways to do it, but it's fast, and more importantly, if it's right, which it is 80-90% of the time, it falls through [i.e., inlines the method for that type - Ed.], which means you maintain your processor pipeline and all that stuff.
So it means they have predicted the type of the receiver. They've successfully inlined that. I mean, you can do a whole bunch of branching, and they actually found out through some experimentation that you only need to do 2 to 4 of these, right, before the gain completely tails off. So you don't have to generate too much of this. And they've expanded on this idea now, for the last ten years.
[Reactie gewijzigd door RayNbow op vrijdag 1 augustus 2008 13:11]
Een ander interessant (maar enigzins gedateerd) artikel is: http://www.idiom.com/~zilla/Computer/javaCbenchmark.htmlMyth: Garbage Collection Is Always Slower Than Doing It by Hand
Actually, until a collection is called, the GC is a lot faster than doing it by hand in C. This surprises a lot of people, so it's worth some explanation. First of all, notice that finding free space occurs in constant time. Since all free space is contiguous, the GC simply follows the pointer and checks to see if there's enough room. In C, a call to malloc() typically results in a search of a linked list of free blocks. This can be time consuming, especially if your heap is badly fragmented. To make matters worse, several implementations of the C run time lock the heap during this procedure. Once the memory is allocated or used, the list has to be updated. In a garbage-collected environment, allocation is free, and the memory is released during collection. More advanced programmers will reserve large blocks of memory, and handle allocation within that block themselves. The problem with this approach is that memory fragmentation becomes a huge problem for programmers, and it forces them to add a lot of memory-handling logic to their applications. In the end, a garbage collector doesn't add a lot of overhead. Allocation is as fast or faster, and compaction is handled automatically—freeing programmers to focus on their applications.
In the future, garbage collectors could perform other optimizations that make it even faster. Hot spot identification and better cache usage are possible, and can make enormous speed differences. A smarter GC could pack pages more efficiently, thereby minimizing the number of page fetches that occur during execution. All of these could make a garbage-collected environment faster than doing things by hand.
[Reactie gewijzigd door johnbetonschaar op vrijdag 1 augustus 2008 19:47]
[Reactie gewijzigd door masterpoi op vrijdag 1 augustus 2008 11:31]
Nou ja, bijna niets - toen men (Brendan Eich) bezig was met de ontwikkeling van JavaScript heeft men de syntaxis van JS afgestemd op die van Java.Maar op technisch gebied hebben javascript en java helemaal niks met mekaar gemeen.
http://wesnerm.blogs.com/...4/09/net_vs_native_p.htmlThe perception that managed applications are slow may be due to self-selection bias. That is, the programmers, most sensitive to performance and most adept at writing performant code, are also the least likeliest to migrate to managed code. The end result is that managed applications tend to be written by less performance-savvy programmers, who are more interested in the managed environment for other reasons like enhanced productivity.
[Reactie gewijzigd door ddofborg op zaterdag 2 augustus 2008 12:07]
[Reactie gewijzigd door DJ Henk op vrijdag 1 augustus 2008 12:03]
[Reactie gewijzigd door Stephan Oudmaijer op vrijdag 1 augustus 2008 11:24]
[Reactie gewijzigd door kluyze op vrijdag 1 augustus 2008 11:28]
[Reactie gewijzigd door Donderwolk op vrijdag 1 augustus 2008 11:02]
En Adobe doet zover ik weet nog niet aan liefdadigheid door hun producten weg te schenken...Ook is er een versie van Project Nile bij de sdk ingesloten. Deze software omvat een aantal plugins voor Illustrator en Photoshop waarmee grafische ontwerpen eenvoudig geëxporteerd kunnen worden, zodat ze in Javafx kunnen worden gebruikt.
http://java.sun.com/javafx/faqs.jspA JavaFX Designer tool is planned for release in the future. The JavaFX Designer tool will provide a comprehensive visual design environment to allow designers to author rich, Internet-enabled content and applications without necessarily knowing the underlying JavaFX Script language or the specifics of the Java platform.
Als je dat naar java vertaalt zou het zoiets zijn:import javafx.ui.*;
Frame {
title: "Hello World JavaFX"
width: 200
height: 50
content: Label {
text: "Hello World"
}
visible: true
}
Dus het is wel iets beknopterimport java.awt.Frame;
import java.awt.Label;
public class Test() {
public Test() {
final Frame frame = new Frame("Hello World Java");
frame.setSize(200, 50);
final Label l = new Label("Hello World");
frame.add(l);
frame.setVisible(true)
}
public static final void main(final String...args) {
new Test();
}
}
Op dit item kan niet meer gereageerd worden.
Populair: Samsung Websites en communities Mobiele telefoons Google Sony Games Microsoft Politiek en recht Consoles Microsoft Xbox One
© 1998 - 2013 Tweakers.net B.V. Contact Over Tweakers Jouw privacy Algemene voorwaarden Cookies
Tweakers wordt uitgegeven door De Persgroep en wordt gehost door True