Nodyn – Node.js for the JVM
nodyn.io
nodyn.io
Nodyn is not yet complete, though I'd like to have a release in the next month that is capable of running express.js apps. It is slower than Node.js, but of course I'd like that to change; and with the JVM underneath, beating Node.js on performance is possible.
Nodyn is built on top of Vert.x (http://vertx.io) an asynchronous polyglot platform which excels on the Techempower benchmarks. The javascript runtime is DynJS - a new JS runtime for the JVM which is independent of Oracle. Though it's admittedly slower than Nashorn at the moment, we hope for that to change.
[1]: http://jxcore.com/
edit:
> All that with vert.x's powerful clustering technology built right in
I think I missed that part. Sorry =)
e: Thank you guys for the answers, definitely makes a lot more sense now.
Also, if you work at a Java shop having stuff run on the JVM affords a way to sneak in new tech. :)
[1] http://torquebox.org/ [2] https://github.com/jruby/jruby/wiki/Servers [3] http://www.restlessprogrammer.com/2013/02/multi-threading-in...
This makes a lot of sense.
Interop with the things that already exist in the Java ecosystem.
> I had this idea before that porting things like Ruby or Rails to the JVM was meant to offer ruby the advantages of having a java core (better threading, garbage collection, faster).
To the extent that those were effects of porting Ruby to the JVM they were mostly secondary, Java interop was the key feature (Rails, BTW, wasn't ported to the JVM, it just runs anywhere you have a functional Ruby implementation -- heck, before Ruby had executable specs, the test for a functional implementation was pretty much "does it run Rails".)
To my mind, the idea of porting is that you face a choice: you can recreate the JVM functionality in your own runtime, or you can port to the JVM. Porting to the JVM is certainly non-trivial, but you then get thousands of man-years of work in return. It's certainly worth doing a project to see whether the porting effort pays off; especially if this done concurrently with working on the language's 'native' runtime.
As long as you aren't native, that is.
Although that's unrelated to the discussion at large.
Is there a C programmer on the planet that does production builds with a non-optimizing compiler? How is your comparison even remotely relevant to the GP?
The advantage of going the native route is that it gives you improved observability and post-mortem. The JVM is a VM (Java's) inside a VM (the OS's), and that additional layer doesn't come for free.
Some of those are actually LLVM frontends.
As for the type of hypervisors you're referring to, those things are effectively half-baked operating systems. That's why something like KVM is better -- you're not pretending to be a non-OS while slowly reinventing a wheel that the *nixes have and always will do better.
I think we're beginning to wander massively afield though! :)
This would allow you to use NodeJS but still leverage the existing Java libraries, not requiring you to rewrite them.
There's a node-ffi package, although it has some overhead from the call itself.
What is the source for that?
My usual response regarding the merit of the JVM is this: there is a reason there's jvm on the server, desktop, on your phone, on the rovers on mars and god knows on how many mission critical systems.
And no it isn't because of great marketing, which is another common and lame response from JVM detractors.
The JVM is an impressive engineering effort and the eco-system spawned by it is currently unrivaled.
With the new trend of porting other languages (ruby,python,js..etc) to it, the I see the JVM as the middleware over which most future software would be built.
At present, there aren't nice binary downloads for anything that can just run node programs, I had to fiddle about a bit to get something I could play with, and even then, only some programs work - npm for example seems to go into a loop.
https://github.com/kybernetikos/avatarjs-sandbox/tree/master...
Also for anyone interested in an easy way to use the JVM for other languages, check out crudzilla.com . It is primarily for web development but has basic editor for other development work.
asm.js isn't relevant here at all.
DynJS could also support asm.js in addition to JavaScript, but that has almost nothing to do with JIT-ing JavaScript applications.
Although with invokedynamic, the JVM's object system ends up being remarkably close to that of a dynamic language. This is best seen in JRuby.
What am I missing?
Is someone working on it?
V8 is in many regards better (especially memory footprint and ramp-up time) or on par.
> clear access to Java directly in your Javascript.
Who needs this when having access to 50K nom packages?
EDIT : seems to be built upon Vert.x ? you can already code in javascript with Vert.x
This way you write JS for Node and you can run it under either Node or the JVM.
As for coding Java on Nodyn, well, yes you can. That's kind of the point in some ways. You can write Java, package it as a jar and access this from Nodyn. Nodyn itself does this for the Buffer implementation.
Yes, vert.x already supports JS (I maintain the mod-lang-js, mod-lang-rhino and mod-lang-dynjs language modules for vert.x). The idea behind Nodyn is to provide drop-in Node.js compatibility in the Vert.x environment.
That said, I'd suggest running node wither a service oriented architecture if both were non-negotiable requirements.