Compiling Spigot to Native Code

Discussion in 'Performance Tweaking' started by marcdraco, May 29, 2016.

  1. I've noticed a few people in the forums have confused the JVM (for bytecode) with a compiler for native arch.

    Java's overhead is a bugbear for me because my machines lack the horsepower to even run an idle Spigot server without getting hot enough to fry an egg. My guess is this is not Spigot's fault, but the underlying JVM JIT compiler.

    Without getting into a long discussion about pros/cons of each method (because I'm sure everyone has an opinion and it's all been argued before and will be again...):

    Is it possible to used GCJ to compile Spigot into a native app? Not being a developer this is beyond me except that I've read that GCJ can compile both Java byte-code and Java source code into native machine language. This has got to be a good thing for little servers like Raspberry PI and its multitude of clones.

    I've tried a C++ server vs Spigot and the difference is enough to burn a careless pinkie: even idling Java is loading the machine quite hard and pushing the core temp into the high 50s (celsius) - even with a heatsink.

    Once again, I don't feel this is a fault of Spigot, purely of the technology it's running on.

    I think of it as riding atop tank when you could be riding a motorbike: with the same engine!
     
  2. I've heard of a few projects that claim to have the ability to convert JAVA projects to C++.

    I don't think it'd be possible/probable considering:
    1) Minecraft already has many memory leaks the JVM covers up
    2) Memory wouldn't be properly handled, therefor leading to more memory leaks (Unless these java to C++ projects somehow managed to insert destructors or possibly a GC like java's)
    3) Not sure how you'd use plugins anymore considering they're all in JAVA.
    4) They'd have to re-compile Spigot for every OS

    The internals of Minecraft are a big mess and i don't see how using any other programming language could possibly clean it up.
     
  3. md_5

    Administrator Developer

    Hotspot is a far better compiler than GCJ, and compiles Spigot to native code ~~~ only the fly ~~~.
     
  4. MiniDigger

    Supporter

    Why do people always blame the vm if thier Programms don't run good?
    The current Java vm (hotspot) performs as it should. If you can't run spigot you should look into getting better hardware, not a better vm.
     
    • Agree Agree x 2
  5. It's probably just the fact that the Minecraft server code is an inefficient mess.
     
  6. Tux

    Tux

    The HotSpot VM is a Just-In-Time compiler, and therefore has comparable native code performance (with notable exceptions, such as first-time start and when it decides to re-optimize code). Skipping directly to compiled code won't work that well if the server code is not optimized for that scenario.

    It's not a good idea to run full Minecraft on a Raspberry Pi anyway (well, you can, but the performance is lacking, especially with chunk generation, so you'd need to pre-generate chunks beforehand).
     
  7. MiniDigger

    Supporter

    No, Java is doing just fine. If you encounter any performance issues that is most likely due to minecrafts bad server implementation. So #BLAMEMOJANG if you need someone to blame.
     
  8. Sarcasm man