5 ms·
Start up time. You can't write cli programs if the JVM takes 100+ms to start up.
by Touche 13y ago
Start up time. You can't write cli programs if the JVM takes 100+ms to start up.
- Jtsummers 13y agoThat's a fair issue, but also a particular use-case. Java seems to be suitable for long running apps where that 100+ms start up time is easily covered as an ammortized cost over the apps uptime. It still doesn't answer what benefit would Java have if it had been native compilation from the start versus VM (and later VM with JIT-compilation). It would not have been able to run on near the number of platforms that it initially supported if, instead of porting a VM, they'd had to support many OS/ISA pairs. The VM -> VM w/ JIT approach provided a deployment path based on incremental improvements. Initially support dozens of platforms with good enough performance, then over time improve performance on each platform. Versus initially support a handful of platforms with good performance and spend years getting the breadth of platform support.
- pjmlp 13y agoSo what? This was the initial way Pascal and Modula-2 were developed. P-Code and M-Code were their bytecodes. This didn't prevent most compiler vendors to introduce native compilers and use those bytecode implementations mainly for bootstraping purposes. Writing compilers is not that dark magic thing many think about. Well, except when targeting x86 processors, maybe. :)
- judk 13y agoHow do webservers solve this problem and why can't CLI programsw do the same? Invoking a Java program could connect to a running jvmd daemon
- Jtsummers 13y agoThey "solve" it by being long running applications. When GP says CLI they likely mean things like grep or cat or other command line tools, not just interfaces, that tend to run in a very short time. A Java implementation would see a lot of extra time spent on just the startup. Consider writing a bash script that calls out to grep for each of a bunch of different files (an example, better ways, but go with it). Say it ran grep 100 times, jgrep at 100ms startup time would take 10s longer just on the java startup time, ignoring any other performance differences.
- hansjorg 13y agoA project which does exactly that: http://www.martiansoftware.com/nailgun/ http://www.martiansoftware.com/nailgun/