Live data from Hacker News

Java Virtual Machine in pure Node.js

github.com

111–120 of 143 posts

Re: Java Virtual Machine in pure Node.js

#111
post #97

Earlier quoted context omitted.

Who doesn't wish it was still 1999? Hot stock market, millenium mania, cheap gas, dot-coms. Really slow Java makes it all come rushing back.

> [1999's] slow Java Java 1.2 (1998) used a JIT and a generational collector. It was probably faster than today's Ruby, Python, or PHP. What was slow was start up. Applets in particular were really horrible since they completely froze the browser for several seconds. If I remember correctly, this was finally fixed many years later with some version of Java 6.0.

It didn't go full speed until Sun released HotSpot, which was probably a year or two later. The farther back in time you go, naturally, the slower Java was, sort of like the universe as you go back to the Big Bang. You also could have made more in the stock market with each receding year. But 1999 was a memorable year.

Re: Java Virtual Machine in pure Node.js

#112
Is PyJNIus support coming anytime soon? The ability to use Python to script Java calls into the JS run-time to access Cordova API's on top of Android libraries is really important for developers who have Python, Cython, and Java skills, but find P4A too daunting compared to Cordova. It's only three more layers of nonsense.

Re: Java Virtual Machine in pure Node.js

#113
post #83

Really cool hack, and yet I can't help but think that the mile-high software stack between the developer and the CPU continues to grow meaning we're stuck in a perpetual game of filling up spare CPU cycles with nothing in particular. I'm sure I'll see a demo showing off something that barely runs on modern hardware that we were more than capable of running with good performance in 1990. sigh I feel like I'm being suc…

Now we just need to wait for someone to run Rhino on this so we can have Javascript hosting a JVM which hosts Javascript.

Re: Java Virtual Machine in pure Node.js

#114

Earlier quoted context omitted.

Hotspot runs the program faster than V8? no problem. Emulate x86 in v8 run hotspot inside emulator. now you got your performance back.

Yes, it's like a beautiful perpetual motion machine. Only one problem. Where's node.js?

I'm thinking the next big step is to build ASIC's with hierarchical memory sub-systems that can quickly load and execute either x86 or ARM instructions, kind of like binary run-times implemented in hardware, and then boot operating systems on them so that programs don't have to worry about the physical memory address layout or disk file-systems, and then finally run a compiled version of the JVM that includes hot-spot. Then we would all be able to run Java, and it would be pretty fast, probably faster than any other implementation, and totally capable of integrating with the entire Java ecosystem.

Re: Java Virtual Machine in pure Node.js

#115

Earlier quoted context omitted.

Who doesn't wish it was still 1999? Hot stock market, millenium mania, cheap gas, dot-coms. Really slow Java makes it all come rushing back.

1999 was right about the time Java starting getting fast enough to use for servers (where you don't care much about start-up time). About that time, I needed to decide whether to use Java or Delphi (an ahead-of-time Pascal compiler) for a new project. I was worried about garbage collection overhead. So, I designed a trivial benchmark wherein an array of simple objects was constructed in a loop (as we revisit each slo…

Highly object-oriented code makes extensive use of memory allocation; I suspect this to be a general rule. Java almost forces you to use this style, so consequently, I expect that the GC is highly optimized for it, and GC is lazy, which cuts the cost of deallocations. I can't see any reason why manual memory management with new/delete, malloc/free, etc, couldn't be done lazy, also, but I think it usually reclaims memory eagerly, and gives a different trade-off (i.e. delete/free are implemented eagerly inside the standard library, rather than just marking the memory and returning). If you want the highest performance, you'll allocate memory in large blocks and take it out of the hands of the GC or library.

PS. I can't swear to it that you could do a decent lazy delete or free and get better performance in C or C++, but it doesn't sound absurd on its face. What the standard library could not do is run its own background thread and update memory structures asynchronously, the way some advanced GCs do. But the whole problem can be avoided by doing fewer allocations in the first place, and performance will be consistently good no matter what the platform.

Re: Java Virtual Machine in pure Node.js

#116

Earlier quoted context omitted.

Yes, it's like a beautiful perpetual motion machine. Only one problem. Where's node.js?

I'm thinking the next big step is to build ASIC's with hierarchical memory sub-systems that can quickly load and execute either x86 or ARM instructions, kind of like binary run-times implemented in hardware, and then boot operating systems on them so that programs don't have to worry about the physical memory address layout or disk file-systems, and then finally run a compiled version of the JVM that includes hot-spo…

What you're describing sounds like how computers work now. What I see as the logical next step is to design chips that use Javascript as their instruction set, because in the future, every layer underneath Javascript will just be overhead, because everything will be Javascript. We might as well start planning for it now.

Re: Java Virtual Machine in pure Node.js

#117

Now, my question is. WHY!? I might be crazy, but does anyone see a legitimate use for this?

This question on this kind of topic needs to stop being asked on Hacker News. It's fair to ask whether or not there was a material usage intended for the project, but if isn't one, we really need to stop implying that there should be.

that's not a chance I'm willing to take. This is how PHP started. It was a reject experiment that escaped the lab. Then some poor souls took it seriously. Now all of humanity suffers.

Re: Java Virtual Machine in pure Node.js

#118
post #110

Earlier quoted context omitted.

The paradigm is that it's easier (cheaper) to have less performant code that takes less time to build for developers then it is to have maximum performant code... This project at least provides the potential for people like myself who have existing Java projects with longstanding functioning methods that I don't want to rewrite in Node.js... Yes it's another layer, but for some functions that layer can be less compli…

> This project at least provides the potential for people like myself who have existing Java projects with longstanding functioning methods that I don't want to rewrite in Node.js In this case, wouldn't a java-to-js translator be more efficient than rewriting the whole jvm for Node.js?

Sometimes you just have to let people try to convince themselves that wildly impractical (but really neat) toys could have serious applications. For example, Node.js.

Re: Java Virtual Machine in pure Node.js

#119

Earlier quoted context omitted.

I'm thinking the next big step is to build ASIC's with hierarchical memory sub-systems that can quickly load and execute either x86 or ARM instructions, kind of like binary run-times implemented in hardware, and then boot operating systems on them so that programs don't have to worry about the physical memory address layout or disk file-systems, and then finally run a compiled version of the JVM that includes hot-spo…

What you're describing sounds like how computers work now. What I see as the logical next step is to design chips that use Javascript as their instruction set, because in the future, every layer underneath Javascript will just be overhead, because everything will be Javascript. We might as well start planning for it now.

like a chip that runs asm.js directly as its instruction set, and a js interpreter written in asm.js, with javascript runtime semantics implemented in hardware?

kind of like the espruino but even moreso?

Re: Java Virtual Machine in pure Node.js

#120
post #83

Really cool hack, and yet I can't help but think that the mile-high software stack between the developer and the CPU continues to grow meaning we're stuck in a perpetual game of filling up spare CPU cycles with nothing in particular. I'm sure I'll see a demo showing off something that barely runs on modern hardware that we were more than capable of running with good performance in 1990. sigh I feel like I'm being suc…

Now we just need to wait for someone to run Rhino on this so we can have Javascript hosting a JVM which hosts Javascript.

Nashorn would be more appropriate once it is released. It leverages the JVM dynamic invocation instructions better IIRC.
Post reply on HN