News for hackers. Stuff that matters.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by shantly on Tuesday December 24, 2019 @10:26AM (#21872620)
It’s been the case ever since I can remember that “Java’s basically as efficient as native, it’s super fast” but all the actual java software I encounter is a slowish, bloated memory hog. I don’t know why, but that’s how it is.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by smabie on Tuesday December 24, 2019 @10:56AM (#21872812)
The style of programming for the dominant JVM languages (Java, Scala, Kotlin) involves an over reliance on churning through a lot of short-term garbage. I think this partially due to how annoying the platform is to actually use. Incredibly complex and chalk full of programmer pitfalls (like type-erasure). In fact, the majority of devs have no clue at how the JVM works, treating it as just “magic.”

I would imagine that Go’s GC is worse than the tunable JVM ones, but go isn’t powerful enough that one would ever be tempted to program in an abstraction heavy style. While I would argue it takes a lot more work to program in Go ca, day Scala, I think the constraints imposed lead to better software. I for one have never seen a JVM desktop or business app that worked super well. The JVM manages to be a highly optimized efficient platform in which almost exclusively slow, laggy, and memory hungry apps are produced. With that being said, it’s a highly productive platform (if you’re using something besides Java), especially for backend business apps.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by mdasen on Tuesday December 24, 2019 @05:21PM (#21875337)
GC is complicated because what works well for one thing might not work well for other things. GC can be both about clever things and about hard trade-offs. That said, I'll try to talk about GC without having a religious war erupt. Keep in mind, something here might be wrong.

Go's GC is tuned for low latency. People hate pause times. They hate it even more than they hate slowness. Go makes a trade-off for short pause times, but in doing so they do sacrifice throughput. That's great for a web server. With a web server, you care a lot about pauses offering a bad experience. A 500ms pause is going to give a customer a bad experience. That's less good for batch processing. Let's say you're running a backfill job that you expect to take 10-15 hours. You don't really care if it pauses for 1 minute to GC every 30 minutes. No one will even know. However, you will know whether it took 10 hours or 15 hours.

Go's GC is meant to be simple for users. I think the only option is "how much memory should I be targeting to use?" That makes it dead simple for users. I think the Go authors are right that too many tuning knobs can be a bad thing. People can spend months doing nonsense work. Worst is that knobs are hard to verify that anything is really different. If you're running a web server, was the traffic really the same? What about other things happening on the machine? Wouldn't you rather be writing software instead?

Go's GC is a non-copying GC. One thing this means is that Go's (heap) memory allocation ends up being very different because Go's memory is going to become fragmented. So Go needs to keep a map of free memory and allocations are a bit more expensive. Java (with GCs like G1) can just bump allocate which is insanely cheap. This is because Java is allocating everything contiguously so it just needs to move a pointer. How does that work once something becomes freed? Java's G1 (the default in the latest LTS Java) will copy everything that's still alive to a new portion of memory and the old portion is then just empty. You kind of see this in Go's culture. Web frameworks obsess about not making heap allocations. Libraries often have you pass in pointers to be filled in rather than returning something.

Go misses out on the generational hypothesis. The generational hypothesis is one of the more durable observations we have about programming - that most things that are allocated die really quickly. C# and Java both use generational collectors by default and they've done way better than what came before. C# and Java don't have as-low pause times as Go, but part of that is that they're targeting other things like throughput or heap overhead more.

Go doesn't need GC as much. Go can allocate more on the stack than Java can and, well, Go programmers are sometimes a bit obsessed with stack allocations even when it makes for more complicated code. Having structs means creating something where you can just have contiguous memory rather than allocating separate things for the fields in your object. Go's authors have observed that a lot of their objects that die-young are stack allocated and so while the generational hypothesis holds, it's a bit different. Go has put a good amount of effort into escape analysis to get more stuff stack allocated.

Java has two new algorithms ZGC and Shenandoah which are available in the latest Java. They're pretty impressive and usually get down to sub-millisecond pause times and even 99th percentile pauses of 1-2ms.

Go's new GC was constrained by the fact that "Go also desperately needed short term success in 2015" (Rick Hudson from Google's Go team) and the fact that they wanted their foreign function interface to be simple - if you don't move objects in memory, you don't have to worry about dealing with the indirection you'd need between C/C++ expecting them to be in one place and Go moving them around. Google's going to have a lot of code they want to use without replacing it with Go code and so C/C++ interop is going to be huge in terms of their internal goals (and in terms of what the team targeted regardless of whether it's useful to you). And I think once they had shown off sub-millisecond pause times, they were really hesitant to do something that might introduce things like 5ms pause times. I think they might have also said that Google had an obsession with the long-tail at the time. Especially at Google, there's going to be a very long tail and if that's what people are all talking about and caring about, you end up wanting to target that.

Go has tried other algorithms. They had a request-oriented-collector and that worked well, but it slowed down certain applications that Go programmers care about - namely, the compiler. They tried a non-copying generational GC, but didn't have a lot of success there.

Ultimately, Go wanted fast success and to solve the #1 complaint people had: extreme pause times (pause times that would make JVM developers feel sorry for Go programmers). Going with a copying GC might have offered better performance, but would have meant a lot more work. And Go gets away with some things because more stuff gets stack allocated and Go programmers try to avoid heap allocations which would be more expensive given Go's choices (programming for the GC algorithm).

I don't think that JVM languages have a programming style that lends themselves to an over-reliance on churning through short-term garbage. Well, Clojure probably since I think it does go for the functional/immutable allocate-a-lot style. Maybe Kotlin and Scala if you're creating lots of immutable stuff just to re-allocate/copy when you want to change one field. That doesn't really apply to most Java programs. And I have covered the way that Go potentially leads to more stack allocations. However, I don't think most people know how their Go programs work any more than their JVM programs and this really just seems to be a "I want to dislike Java" kind of thing rather than something about memory.

Java programs tend to start slow because of the JVM and JIT compilation. Java has been focused on throughput more than Go has (at the expense of responsiveness). That is changing with the two latest Java GC algorithms (and even G1 which is really good). Java is also working on modularizing itself so that you won't bring along as much of what you don't need (Jigsaw) and AOT compilation. Saying that Java is slow just isn't really true, but it might feel true - things like startup times and pause times can inform our opinions a lot. There's absolutely no question that Java is a lot faster than Python, but Python can feel faster for simple programs that aren't doing a lot (or are just small amounts of Python doing most of the heavy work in C).

I mean, are you including Android in "all Java apps"?

Java, C#, and Go are all really wonderful languages/platforms (including things hosted on them like Kotlin). They're all around the same performance, but they do have some differences. I think Go should re-visit their GC decisions in the future, especially as ZGC and Shenandoah take shape, but their GC works pretty well. But there are certainly trade-offs being made (and it isn't around language features that make the platform productive for programmers). I think GC is very interesting, but ultimately Java, C#, and Go all have very good GC that offers a good experience.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by loopz on Wednesday December 25, 2019 @06:54AM (#21878137)
Nice writeup!

If a programmer really cares for performant batch-processing (not sure it's a direction we're going for anymore but), you'll just reuse your objects and dataspace. Understanding Go in order to minimize GC is pretty trivial and the standard library includes packages and tooling exactly for such purposes. Most likely, there are only a few hotspots needing to be tended to like this.

So this sounds like Golang is optimized for what people love about computing: fast response time. Also providing programmers with basic performance "out of the box", which is another good tradeoff for me.

The tradeoff works best when you make simple designs, not huge behemoths. Spending more time reiterating clever designs, rather than jamming the keyboard until done.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by ptx on Tuesday December 24, 2019 @07:30PM (#21875895)
Java is slower than Python for simple short-running programs. When Python is finished Java is still struggling through start-up and class-loading.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by twic on Wednesday December 25, 2019 @12:30PM (#21879470)
Is this actually true? Have you measured this, or seen measurements?
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by ptx on Thursday December 26, 2019 @05:10PM (#21887272)
Here are measurements for an extreme case of a short-running simple program:

  $ cat Hello.java 
  class Hello { public static void main(String[] args) { System.out.println("Hello from Java!"); } }

  $ cat hello.py 
  print("Hello from Python!")

  $ time /usr/lib/jvm/java-13-openjdk/bin/java -Xshare:on -XX:+TieredCompilation -XX:TieredStopAtLevel=1 Hello
  Hello from Java!

  real 0m0.102s
  user 0m0.095s
  sys 0m0.025s

  $ time python3 -S hello.py 
  Hello from Python!

  real 0m0.034s
  user 0m0.020s
  sys 0m0.013s
It's a bit faster if you create a custom modular JRE with jlink:

  $ /usr/lib/jvm/java-13-openjdk/bin/jlink --add-modules java.base --output /tmp/jlinked-java13-jre
  $ /tmp/jlinked-java13-jre/bin/java -Xshare:dump
  $ time /tmp/jlinked-java13-jre/bin/java -Xshare:on -XX:+TieredCompilation -XX:TieredStopAtLevel=1 Hello
  Hello from Java!

  real 0m0.087s
  user 0m0.050s
  sys 0m0.035s
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by ptx on Thursday December 26, 2019 @09:15AM (#21883901)
Yes, I often write small command-line tools and that's what I found. Profiling seemed to indicate that doing anything at all in Java, such as reading a config file, is fast the second time but super slow the first time.

You can test my assertion simply by writing a "hello world" in Python and Java.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by mewmew on Tuesday December 24, 2019 @10:46PM (#21876656)
Thanks for the in-depth write-up @mdasen. I certainly learnt a lot about general GC properties and trade-offs.

takes hat off in appreciation

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by kyrra on Tuesday December 24, 2019 @10:03PM (#21876477)
Great reply. Thanks for taking the time to write it.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by wejick on Tuesday December 24, 2019 @08:17PM (#21876081)
Nicely written
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by btilly on Tuesday December 24, 2019 @03:49PM (#21874817)
I would imagine that Go’s GC is worse than the tunable JVM ones, but go isn’t powerful enough that one would ever be tempted to program in an abstraction heavy style.

That is a compliment.

One of the design criteria for Go was to push programmers away from being architecture astronauts whose abstraction heavy style results in having no idea how much work you are hiding in all of the layers. And that design criteria was based on analysis of the actual failure modes of significant software projects.

Therefore the fact that real world Go apps generally manage to avoid that failure more is a testament that they succeeded in this design criteria.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by kod on Tuesday December 24, 2019 @07:32PM (#21875910)
Generics are architecture astronomy?

This is parroting anti-intellectual nonsense.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by btilly on Tuesday December 24, 2019 @07:56PM (#21875997)
Generics as done in C++ templates lend themselves to that.

Inheritance as done in most OO systems does likewise.

You will note that the core Go team has a desire to add generics. However they also feel that it is a potential Pandora's box.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by fauigerzigerk on Wednesday December 25, 2019 @06:40AM (#21878104)
Interestingly though, some of the worst excesses of overdesigned architectures in Java happened before Java even had generics, and heavy use of interfaces was a standout feature.

So Go has absolutely everything a true architecture astronaut needs. In my view, the big difference is cultural and has nothing to do with language features.

Also, the lack of generics often forces you to use reflection to avoid code duplication, which makes for very complex, error prone code.

As an example consider the sort package in Go's standard library. Here's what they had to write in order to generically swap two elements in a []interface{}:

https://golang.org/src/internal/reflectlite/swapper.go

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by Gibbon1 on Wednesday December 25, 2019 @07:09PM (#21881216)
I suspect a problem with Java is it's culture and ecosystem evolved in the early 90's when memory, disk, and processor speeds were doubling every few months.

Go in the late 2000s after Amdahl's law had been bitch slapping everyone for 10 years. Network bandwidth increased but laterncy didn't. Processor transistor counts increased but clock speeds didn't. Memory increased but memory bandwidth didn't keep up.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by LessDmesg on Wednesday December 25, 2019 @02:40AM (#21877448)
C++ templates are not the gold standard of generics. In fact, they are a glorified text substitution system, totally broken and flawed.

Generics are still absolutely necessary for ANY serious programming language. They are required by the DRY principle. Algorithms must not need be repeatedly implemented for every new data structure. To say that generics are astronaut is simply unprofessional.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by flavio81 on Thursday December 26, 2019 @03:50PM (#21886654)
>One of the design criteria for Go was to push programmers away from being architecture astronauts whose abstraction heavy style results in having no idea how much work you are hiding in all of the layers.

So they chose to create a language where there's no way to get around creating vast amounts of boilerplate. This boilerplate heavy code style results in having no idea of the true logic you are hiding in all of the boilerplate.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by sorokod on Tuesday December 24, 2019 @11:45AM (#21873190)
"over reliance on churning through a lot of short-term garbage"

this is handled super efficiently by generational garbage collectors.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by ec109685 on Tuesday December 24, 2019 @12:13PM (#21873378)
Right, you only pay for the memory reachable when the slow / blocking part do the garbage collection runs, so a lean program that churns through small objects can be very responsive.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by deschutes on Tuesday December 24, 2019 @11:48AM (#21873212)
To my understanding, all of jetbrains products run on the jvm. They work pretty well although I wouldn't characterize them as lean.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by smabie on Wednesday December 25, 2019 @10:09PM (#21881818)
Work well? I program professionally in Scala and IntelliJ is fucking terrible. Me and everyone on my team yells “fucking IntelliJ” and restarts the damn thing at least once a day.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by cy_hauser on Tuesday December 24, 2019 @11:47AM (#21873200)
(ftf it's chock-full not chalk full.)
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by apta on Wednesday December 25, 2019 @07:22AM (#21878225)
> I for one have never seen a JVM desktop

> or business app

Practically every large site you use (Google, Amazon, FB, GitHub, Apple, Twitter, and many more) are using Java/JVM in the backend in some non-trivial capacity.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by smabie on Wednesday December 25, 2019 @10:08PM (#21881815)
>I for one have never seen a JVM desktop or business app that worked super well.

And I think none of them work super well.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by yumaikas on Tuesday December 24, 2019 @10:44AM (#21872717)
A big part of that is that this benchmark is not representative of what general software is like, not in Go, not in Java.

For one thing, most software isn't churning on an array of integers. It's allocating and managing various types of objects.

I haven't written a ton of java, but I suspect that the various reflection-heavy frameworks also impose a lot of overhead into the resulting software that isn't necessarily inherently part of Java the language.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by slaymaker1907 on Tuesday December 24, 2019 @02:00PM (#21874152)
Reflection actually isn’t too inefficient, especially compared to using dynamic languages. I think a lot of the inefficiency is a bunch of small inefficiencies which combine together to make it very heavyweight.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by chrisseaton on Tuesday December 24, 2019 @04:52PM (#21875146)
> Reflection actually isn’t too inefficient

My understanding is that it's completely uncached. It couldn't be any less efficient.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by twic on Wednesday December 25, 2019 @03:23PM (#21880251)
Obtaining a Method object is, I think, pretty slow. But calling through one is fast - I'm not sure what happens exactly, but after some number of calls, some sort of JITting or some such happens and a call via a Method object is as fast as as through a handwritten equivalent (which does the same unpacking of arguments etc).
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by kasperni on Tuesday December 24, 2019 @07:19PM (#21875851)
The overhead of, for example, invoking a method via reflection is measured in single-digit nanoseconds. Still not as fast as direct invocation, but unlikely to be a bottleneck unless you perform 10-of-millions of them per second.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by LgWoodenBadger on Tuesday December 24, 2019 @08:00PM (#21876010)
Actually finding the method via reflection is the time consumer.

Once you have the method reference, actually invoking it isn’t any different than a regular method.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by sk5t on Tuesday December 24, 2019 @11:54PM (#21876898)
Although I can't tell you why, it's been my experience that firing a simple method via reflection in both .NET and the JVM is roughly 2x the time of direct calls (or of calls via the 'dynamic' keyword in C#).
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by TOGoS on Tuesday December 24, 2019 @11:01AM (#21872851)
Java has the misfortune (especially in older versions of the language) of limited syntax that encourages bloated frameworks that promise to marginally decrease boilerplate, combined with a VM that's robust enough to actually handle the bloat fairly gracefully.

If you ignore that stuff and write Java programs in a straightforward way (accepting its verbosity, or possibly using code generation instead of runtime frameworks in places where lisp folks would use a bunch of macros), and avoid unnecessary heap allocations, they can be pretty fast.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by AtlasBarfed on Tuesday December 24, 2019 @10:33PM (#21876591)
Verbosity: use Groovy with CompileStatic.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by manishsharan on Tuesday December 24, 2019 @10:54AM (#21872798)
It also depends on how much effort was put into optimizing the system. Quite often , people abuse -Xms and -Xmx by setting it to an unnecessarily high number. Or not checking their code for memory leaks. I am often surprised by how many java programmers have never run their code through a profiler.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by pron on Tuesday December 24, 2019 @03:45PM (#21874790)
I doubt that's true. The actual Java software you encounter includes much of Amazon, Apple, Google, and Netflix. I mean, everything is relative, but it's faster than Go and less bloated (what does that even mean?) than Python or JS.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by shantly on Tuesday December 24, 2019 @05:29PM (#21875379)
I just mean all the developer tools, consumer-facing GUI software, and a wide variety of server software & daemons. All of those that I’ve seen in Java over the last 20ish years. Perhaps the tech giants are all writing Java that’s nearly as low-footprint and fast as C, I dunno, no way to tell from this side. I can only sample programs I’ve had access to.

[edit] bloated = much higher memory requirements than I’d expect for what they’re doing (yes I know how to configure jvm memory and such), affects the performance of other software on the same machine more than I’d expect, if running on battery, fairly likely to chew through it while doing nothing.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by pron on Tuesday December 24, 2019 @06:27PM (#21875634)
> I can only sample programs I’ve had access to.

You have access to Java programs all the time; much of the software you depend on is Java. You're talking about software you run locally on your desktop -- that's something quite different. Desktop applications are a relatively exceptional use of Java these days, although they're still doing better in both performance and footprint than the fashionable JS apps.

> affects the performance of other software on the same machine more than I’d expect, if running on battery, fairly likely to chew through it while doing nothing.

Let me repeat what I said in another comment. Java uses less energy than Go, significantly less than JS, and a whole lot less than Python: https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sle...

Python may require less memory, but you'll overall need more hardware to do the same work as Java.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by shantly on Wednesday December 25, 2019 @12:13AM (#21876963)
> You're talking about software you run locally on your desktop -- that's something quite different.

> > and a wide variety of server software & daemons

Mind, I don't hate Java or anything, I'm just saying, I've been hearing folks tell me it's definitely fast & nimble while watching it not actually be fast or nimble for north of two decades. I don't know where theory and practice diverge, but with significant frequency when it comes to Java, they very noticeably do, and always have. And no, not just on desktop applications, but sure, exceptionally so there.

And god, I'd hope it'd do better than any scripting language whatsoever by practically any performance measure. If not, what's the point? Those are basically never reasonably fast at real work unless they're just tying together C libraries that're doing the heavy lifting.

As for the reference, yes, there are always benchmarks, always papers, always articles, always folks who'll patiently explain why Java must, certainly, be incredibly speedy. Seriously, 20+ years of reading that. Meanwhile when I use Java software it's usually not half as impressive on the performance and respectfulness to hardware fronts as those imply it must be. Again, I am not sure why this is, but it's been so consistently true for so long across so many types of Java program I've used that I don't think I've just managed to somehow use every single one of the worst-written Java programs in existence, or something.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by zmmmmm on Wednesday December 25, 2019 @04:22PM (#21880558)
> I've been hearing folks tell me it's definitely fast & nimble while watching it not actually be fast or nimble for north of two decades

You're going to have to get over some perceptual bias to ever understand the people saying thiese things. It's absolutely true that Java's weak points sit in many of the areas that are directly observable (startup time, UI - Swing etc.) while its strong points mostly sit in the ones that aren't (how fast code runs after 10 cycles of JIT profiling etc). But my suggestion is that its worth doing that because just like a million other things in the world that you can't directly observe, it's very valuable to understand nonetheless their underlying properties.

Just for a reference point, I work in a space where performance is very critical and the code I write takes ages to start (where ages = 1-2 seconds) but then competes head to head with C code in efficiency. It's probably half as efficient as well optimised C code but it brings the huge other benefits that the JVM has so it's ultimately easily worth that tradeoff to me.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by pron on Wednesday December 25, 2019 @11:32AM (#21879156)
If you're aware of a language/platform with a better productivity/performance ratio, I'd love to know about it. I have not found one. The only languages/platforms that can beat Java at the workloads it excels at -- large concurrent server applications -- can only do so with great effort. If Java is slow and sluggish, then JS, Python, Go, Haskell, C# and Erlang are more so, and there's a reason companies prefer it to C/C++ for a great many applications. That Java is speedy isn't theory. The world's largest tech companies and largest non-tech companies stake many of their critical applications and a lot of money on it, and depend on it being speedy. Smaller companies (like Twitter, Soundcloud, Spotify, Uber and recently GitHub) regularly migrate to Java when they need more speed or better hardware utilization. So you're not personally convinced because you just don't feel it? That's OK. Those that need to be convinced are.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by scarface74 on Tuesday December 24, 2019 @03:56PM (#21874862)
I’m not saying Java is slow or fast, but just because it is used by large companies doesn’t say anything. They have the resources to throw hardware at it.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by pron on Tuesday December 24, 2019 @04:00PM (#21874878)
They also need to serve a lot of people. Java also uses less energy than Go, significantly less than JS, and a whole lot less than Python [1]. Those big companies also need to care about that (not to mention about Java's combination of performance, productivity, serviceability and stability).

[1]: https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sle...

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by scarface74 on Tuesday December 24, 2019 @10:56PM (#21876693)
Apple uses (used?) WebObjects for the iTunes/App Store. I doubt they are using the latest most finely tuned version Java for it.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by AtlasBarfed on Tuesday December 24, 2019 @10:36PM (#21876607)
re: bloated

Well, at least there's a comparison. It's incredibly annoying when zealots characterize their preferred <whatever> with "high performance", "lightweight", or, worst of all, "powerful".

In addition to the inherent lack of specificity, all of those are relative terms to <something else> but that is always omitted.

Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by zmmmmm on Wednesday December 25, 2019 @04:12PM (#21880495)
I think it's a combo of several different things, some of them real, but mostly wrong:

  - most people judge by their personal realtime interaction with Java which is 
    generally dominated by startup times (command line / desktop) or UI (Swing)
    both of which are Java's weak points. They don't have any way to experience
    the efficiency that happens silently under the covers after JIT has occurred
    in a server side application so they assume it doesn't exist.
  - a huge amount of Java software is enterprise garbage that would be garbage
    in every lanuage - Java just happened to win the lottery of adoption there
  - the ecosystem DOES encourage sucking in a HUGE amount of libraries. Java
    developers will pull in a 10mb dependency because it gives them a just 
    slightly nicer API to something because doing that is so easy. But the
    result is enormous runtime library footprint.
About 80% of this is perception bias, about 20% of it is real IMHO. Java is amazing to use for high performance work, and it really does compete with fully compiled languages while maintaining many of the benefits of interpreted languages (true cross platform, hot-swap code, debugging, etc.)
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by jayd16 on Tuesday December 24, 2019 @05:32PM (#21875386)
Like what? What do you encounter that's a slow Java app? It's really fallen out of favor in the desktop app space so it's probably not that.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by ptx on Tuesday December 24, 2019 @07:32PM (#21875912)
It fell out of favor because all the Java apps people encountered in the desktop app space were slow.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by jayd16 on Tuesday December 24, 2019 @10:00PM (#21876471)
I think it has much more to do with the fact that there isn't a really great desktop UI framework for Java. Electron is a slow memory hog and people tolerate that fine.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by vips7L on Wednesday December 25, 2019 @11:34AM (#21879165)
JavaFX is alright. Its just not what JS/webdevs are used to.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by nobleach on Wednesday December 25, 2019 @12:23PM (#21879432)
The only Java deskop app I've used that doesn't feel bloated is Charles. It _still_ has that Swing "almost looks like OSX" look to it but otherwise, it's completely usable. I use IntelliJ nearly every day, and while it's insanely powerful, it feels so incredibly bloated. I'm running on a 6th gen Thinkpad X1C (Arch Linux), a 2017 Macbook Pro (both with 16G of RAM) and a brand new Ryzen 7 with 32G of Ram. It just isn't snappy. I've always wanted to write a JavaFX app and compare it across platforms. I've seen some really nice demos.
Re:Java JIT vs. Java AOT vs. Go for Small, Short-Lived Proce... by jayd16 on Wednesday December 25, 2019 @06:33PM (#21881092)
The slowest part of IntelliJ is scanning the project. I much prefer Rider over VisualStudio though. It doesn't feel any slower to me despite being Java.