News for hackers. Stuff that matters.
Re:TeaVM: Build Fast, Modern Web Apps in Java by patates on Sunday January 31, 2021 @09:12AM (#25978936)
I'm sincerely wondering how you came to that conclusion. Java has one of the fastest VMs, but maybe you mean the startup speed?
Re:TeaVM: Build Fast, Modern Web Apps in Java by pharmakom on Sunday January 31, 2021 @09:26AM (#25979026)
JVMs that most people use are optimised for repeated execution of the same code paths on long running processes. If this isn’t your use-case then lots of tuning work is required.
Re:TeaVM: Build Fast, Modern Web Apps in Java by dukeyukey on Sunday January 31, 2021 @09:57AM (#25979275)
That fits the common Java use-case of servers and desktop applications. Not so much for Lambda instances or command-line tools, but Java isn't highly used there anyway.
Re:TeaVM: Build Fast, Modern Web Apps in Java by JAlexoid on Sunday January 31, 2021 @01:27PM (#25981169)
I don't know where you're getting this...

Lambda instances run really well with JVMs(the whole COW memory architecture)... and even CLIs run well enough.

Re:TeaVM: Build Fast, Modern Web Apps in Java by pjmlp on Sunday January 31, 2021 @09:36AM (#25979092)
Like using the AOT compiler or JIT caches provided in recent versions, they are no longer features only available to customers of commercial JDKs.
Re:TeaVM: Build Fast, Modern Web Apps in Java by skjfdoslifjeifj on Sunday January 31, 2021 @10:33AM (#25979520)
The free AOT compilers have atrocious compile times (far, far worse than even Rust or Scala) and don't support all of the features so library support is extremely fragile. A lot of extremely popular Java libraries make extensive use of runtime reflection and none of the AOT compilers handle it well without a lot of extremely error prone manual configuration.

I actually like Java and the JVM but if AOT compilation and efficient memory usage is what you want Java is definitely not the language to use.

Re:TeaVM: Build Fast, Modern Web Apps in Java by imtringued on Sunday January 31, 2021 @11:31AM (#25979948)
Yes, GraalVM requires a new sub ecosystem of libraries that are built with it's native image feature in mind. That means no more Spring, no more Hibernate and so on. Old codebases will not benefit and new code base require abandoning your existing Java expertise.
Re:TeaVM: Build Fast, Modern Web Apps in Java by skjfdoslifjeifj on Sunday January 31, 2021 @11:56AM (#25980189)
I agree. My main issue is with the Java zealots that come into the discussion and make it seem like anyone can just take their existing Java application and use it with an AOT compiler. The reality is that you will most likely have to make changes to your code, do a significant amount of configuration, and heavily modify or remove dependencies. Furthermore, you are isolating yourself from the huge Java community because very few people are using any of the existing AOT Java compilers.

They try to paint an extremely rosy picture of the current situation when the reality is that it's a very long way from the experience you get in Rust, Go, D, C, C++, Haskell, Ocaml or any of the languages where AOT is considered the default.

Re:TeaVM: Build Fast, Modern Web Apps in Java by sitkack on Sunday January 31, 2021 @01:10PM (#25980988)
> main issue is with the Java zealots

Any sufficiently large population will have someone who will literally say anything. And the common outrage trope on the internet is to rage against a straw man.

Now I haven't used GraalVM in production, but in having played around with it and doing new code from scratch, I found AOT compilation to be really good.

I think the change will come faster than you think.

You can build your leaf, domain level code into a native shared lib and still use the reflective code at the top level to compose the application.

https://www.graalvm.org/reference-manual/native-image/#build...

If Java gets CTFE (compile time function evaluation), constexpr for C++ folks, much of the need for runtime reflection would disappear.

There is no reason that JITed reflective code (along with VM) can't be combined AOT code in the same program. You can already do this in Graal via front ends for llvm-ir and wasm.

As it is now, you can already mix Rust, C, C++ trivially with bytecode via LLVM ir. And for languages that compile to Wasm, GraalVM has a front end for that as well.

https://www.graalvm.org/reference-manual/wasm/#embedding-web...

Re:TeaVM: Build Fast, Modern Web Apps in Java by kitd on Sunday January 31, 2021 @02:20PM (#25981640)
If Java gets CTFE (compile time function evaluation), constexpr for C++ folks, much of the need for runtime reflection would disappear.

Just to remind people that Quarkus has a "pre-compile" stage that allows code to wire itself up using reflection, annotations, config properties, etc, before the full compile. This makes start-up times much faster.

Re:TeaVM: Build Fast, Modern Web Apps in Java by pjmlp on Sunday January 31, 2021 @12:24PM (#25980500)
Thanks for the compliment, I deliver software solutions in Java, C#, JavaScript, TypeScript, Swift, Objective-C, C++.
Re:TeaVM: Build Fast, Modern Web Apps in Java by BoyRobot777 on Sunday January 31, 2021 @02:03PM (#25981498)
> no more Hibernate and so on

Quarkus, Redhat's, native first frameworks works fine with Hibernate and GraalVM. One of contributors gave a [talk](https://www.youtube.com/watch?v=za5CSBX-UME&feature=youtu.be)

Re:TeaVM: Build Fast, Modern Web Apps in Java by pjmlp on Sunday January 31, 2021 @11:40AM (#25980015)
They work perfectly fine with JIT caches.

Plus not everyone is fan of Spring and Hirbenate.

The first I used only once in 20 years of Java projects, the second is the first to go away when I get called to optimise database performance in Java applications.

Re:TeaVM: Build Fast, Modern Web Apps in Java by pjmlp on Sunday January 31, 2021 @11:37AM (#25979993)
Hence JIT caches.
Re:TeaVM: Build Fast, Modern Web Apps in Java by throw2838 on Sunday January 31, 2021 @09:20AM (#25978992)
Slow startup from command line
Re:TeaVM: Build Fast, Modern Web Apps in Java by JAlexoid on Sunday January 31, 2021 @01:36PM (#25981265)
Is sub 100ms not enough these day?

Sure... IntelliJ IDEA startup isn't instant. Atom's startup isn't instant. QT Creator's startup isn't instant. GIMP starts in a few seconds... etc.

Re:TeaVM: Build Fast, Modern Web Apps in Java by pjmlp on Sunday January 31, 2021 @09:35AM (#25979087)
All free JDKs now offer AOT compilers and JIT caches.
Re:TeaVM: Build Fast, Modern Web Apps in Java by coldtea on Sunday January 31, 2021 @09:43AM (#25979156)
Which is relevant for a server how?
Re:TeaVM: Build Fast, Modern Web Apps in Java by forgetfulness on Sunday January 31, 2021 @09:53AM (#25979235)
This is on the comment thread of a tool to make client-side applications.

However, it's all besides the point because this tool takes Java (JVM) bytecode and translates it to WebAssembly, there's no JVM involved for end users at any point.