News for hackers. Stuff that matters.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by bascule on Monday November 26, 2012 @09:50PM (#4835367)
Nashorn is a JavaScript runtime based on the InvokeDynamic instruction and series of APIs added to the Java VM in Java 7. These APIs are set to be radically improved in Java 8, compiling the existing JVM instruction to bytecode which will pass through the full HotSpot compiler.

If you're interested in InvokeDynamic, perhaps you'll check out the slides on a talk I gave about it:

https://speakerdeck.com/tarcieri/invokedynamic-your-guide-to...

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by insin on Monday November 26, 2012 @09:57PM (#4835390)
At JavaOne this year, the Nashorn team were also demoing Node.jar, a port of the Node.js APIs which runs on Nashorn.

The talk one of the team members gave [1] on invokeDynamic and their under-the-hood Dynalink [2] library was pretty interesting.

Links to all the Nashorn sessions at JavaOne are available on their blog [3].

[1] https://oracleus.activeevents.com/connect/sessionDetail.ww?S...

[2] http://szegedi.github.com/dynalink/

[3] https://blogs.oracle.com/nashorn/entry/welcome_to_the_nashor...

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by chubbard on Monday November 26, 2012 @10:33PM (#4835481)
Rhino has pretty good performance. It's about 1.6x Java's performance which made it pretty darn fast for most scripting languages built on the JVM. I would expect this new project will follow the ScriptEngine API so you could swap out a Rhino interpreter with Nasborn engine. This would make it easy to compare how much the InvokeDynamic instruction can contribute to performance boost. I wonder if it can achieve near Java performance parity.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by wmf on Tuesday November 27, 2012 @01:07AM (#4835894)
Setting aside what 1.6x means, Rhino is much much slower than V8 or Java. In fact, there's a bit of an elephant in the room here because people don't really care about Nashorn vs. Rhino; they care about Nashorn vs. V8.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by kybernetikos on Tuesday November 27, 2012 @02:11AM (#4836030)
My sudoku solver http://dancing-links.herokuapp.com/ in javascript takes roughly a tenth of the time to solve a particular puzzle when running in node/V8 than in Rhino.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by chubbard on Tuesday November 27, 2012 @08:21AM (#4836985)
There is a big difference between interpreted rhino vs. compile rhino. The Rhino wikipedia page claims compiling to byte code "... produced the best performance, often beating the C implementation of JavaScript run with just-in-time". However, the benchmarks I've seen put Rhino compiled to byte code at about 60% slower than comparable Java code.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by pbiggar on Monday November 26, 2012 @11:24PM (#4835619)
What does it mean to be about 1.6x Java's performance? Can you be specific - it doesn't seem to mean much since its implemented on the JVM. Also, I've been using it recently and "dog slow" is how I would describe it.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by chubbard on Tuesday November 27, 2012 @08:11AM (#4836955)
Roughly performance tests have shown: Java Performance (ms) * 1.6 = Compiled Rhino Performance (ms). So Rhino is about 60% slower than comparable Java code if you compile it to byte code on average.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by scubaguy on Tuesday November 27, 2012 @01:02AM (#4835881)
It means algorithms runs 1.6x faster within Rhino. A JVM implemented in Rhino that runs Rhino within the JS-JVM will run even faster - roughly 2.56x faster.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by jhdevos on Tuesday November 27, 2012 @05:14AM (#4836493)
Wow! So, with an infinite stack of Rhino inside JVM inside Rhine ..... you could get infinite performance! Cool....
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by _quasimodo on Tuesday November 27, 2012 @05:51AM (#4836579)
It's Rhinos all the way down ...
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by Cthulhu_ on Tuesday November 27, 2012 @04:18AM (#4836350)
Which algorithms, what implementations thereof?
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by rb2k_ on Tuesday November 27, 2012 @06:27AM (#4836672)
Fun fact: Nashorn is the German word for a Rhinoceros and the literal translation would be "Nosehorn".

And according to Wikipedia: The word rhinoceros is derived through Latin from the Ancient Greek: ῥῑνόκερως, which is composed of ῥῑνο- (rhino-, "nose") and κέρας (keras, "horn").

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by throawaypronuc on Tuesday November 27, 2012 @08:30AM (#4837012)
Also, the correct pronunciation is "naaas-horn" ;-)
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by danneu on Tuesday November 27, 2012 @12:21PM (#4837709)
A throwaway account just to chime in the pronunciation. Is this what the world is coming to?
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by ajuc on Tuesday November 27, 2012 @08:33AM (#4837019)
In Polish it's similiar - rhinoceros is "Nosorożec" which means "[with] horny nose" literally.

Unicorn is "Jednorożec" which means "[with] one horn".

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by kibwen on Monday November 26, 2012 @10:51PM (#4835518)
Does anyone know if this project would obviate Rhino? I'd always sort of assumed that its maintenance was a bit of a low priority for Mozilla, but after seeing the bits of praise in this thread for Rhino perhaps it's not as neglected as I'd suspected.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by msgilligan on Tuesday November 27, 2012 @01:04AM (#4835885)
Nashorn will not be fully backward compatible with Rhino. Nashorn will be very ECMA compliant, but will not implement some Mozilla and/or Rhino-specific extensions. So not all Rhino-based projects will be able to easily migrate. But it's not hard to imagine that Nashorn will divert attention and resources away from Rhino.

(I believe I got the above information from the MP4 of the JavaOne presentation that can be found here: https://oracleus.activeevents.com/connect/sessionDetail.ww?S...)

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by msgilligan on Tuesday November 27, 2012 @01:12AM (#4835910)
I should add that a modified version of Rhino has been bundled with the JVM since Java 6 (aka 1.6), but it is likely (if not already announced) that future releases of Java from Oracle will bundle Nashorn instead.
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by pbiggar on Monday November 26, 2012 @11:27PM (#4835626)
For others who are interested in fast JS in Java, we've been working on a embedding V8 into clojure using JNA. A working prototype that's good enough for us is at https://github.com/circleci/clj-v8.

I'm using it to port dieter (clojure asset pipeline we to serve https://circleci.com [https://github.com/edgecase/dieter ]) from Rhino to Dieter. Our current 100s asset compiles are unbearable, and are only about 4s with V8.

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by jschrf on Monday November 26, 2012 @09:54PM (#4835381)
Interesting. I'm no JVM expert but it seems like they will be leveraging the aforementioned MethodHandles and InvokeDynamic for speed gains with JS.

I'm interested in how this will stack up to Rhino over the long term not just in performance but especially in ease of use.

Rhino is ridiculously easy to use and the "javaToJs" method(s) are wonderful.

Can anybody shed light on any over newer JVM features these guys are planning on utilizing (and why)?

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by tantalor on Monday November 26, 2012 @10:14PM (#4835432)
> The goal is to provide a lightweight high performance JavaScript on a native JVM.

Can somebody please explain what a "native" JVM is?

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by ddimitrov on Tuesday November 27, 2012 @06:48AM (#4836725)
By "native" they mean JVM-native (not OS-native). I believe what they really mean is that they use JVM primitives for dispatch, as opposed to building their own using functor objects and reflection-like API (which was the only way to implement MOP pre-InvokeDynamic).

It is a bit misleading as there is still a lot that would have to be be emulated - the JVM does not support open types and the Java is centered around classes, which makes prototype mutation hard to implement efficiently ( InvokeDynamic somewhat helps, but would still impose a performance penalty when the prototype is changed).

See also John Rose's article about species: https://blogs.oracle.com/jrose/entry/larval_objects_in_the_v...

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by svachalek on Monday November 26, 2012 @10:50PM (#4835512)
I believe it's in reference to a JVM that compiles to native code, rather than a naive interpreted one (most of which went extinct a decade ago).
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by chadrs on Tuesday November 27, 2012 @12:33AM (#4835808)
Seems like the more ambiguous term here is "lightweight."
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by vetler on Tuesday November 27, 2012 @07:20AM (#4836806)
I was a bit surprised to see the title here, because the Nashorn project isn't new - what's new is that it is now an OpenJDK project. Oracle has been working on it for a while, it was first announced in July 2011.

More info: http://en.wikipedia.org/wiki/Nashorn_(JavaScript_engine)

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by Scotchy on Tuesday November 27, 2012 @04:54AM (#4836436)
There is someone who already ported V8 as an implementation of JSR223: http://code.google.com/p/jav8/

Had a try and it seems promising. The only drawback I see is that there are still bugs, and the owner is the sole developer for the project, and he seem to have plenty of other projects going on...

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by yuchi on Tuesday November 27, 2012 @03:48AM (#4836271)
This is good news for everyone.

To have real good traction it must be easy to develop the nodejs standard library on it. If this happens, well, it would be pretty awesome. How are they going to manage the async structure for calls to other JVM compatible languages?

Re:New Project: Nashorn – Lightweight High-Performance JavaS... by EzGraphs on Monday November 26, 2012 @09:35PM (#4835321)
From the post: "This project intends to enable Java developers to embed JavaScript in Java applications and to develop free standing JavaScript applications using the jrunscript command line tool."
Re:New Project: Nashorn – Lightweight High-Performance JavaS... by borplk on Tuesday November 27, 2012 @06:57AM (#4836753)
I just wonder what non-technical people with no knowledge of this kind of thing will think if they read a title like this.