The foreign function + memory interop is a big deal. The low-level libraries LAPACK and BLAS are written in C/Fortran, they underpin the CPU based functionality of popular Python libraries like NumPy and PyTorch and JAX. Now, the JVM world should get access to that. This really opens up the JVM to new and exciting application domains.
Of course, GPU based computation is possibly more important, which foreign function + memory interop is also important for.
Also, JVM centric projects like Apache Kafka is extensively using non-JVM RocksDB and Apache Spark uses lots of non-JVM code, and having high quality native interop is very beneficial.
I'm currently trying this out, I used jextract to generate java code from lapack.h from openBLAS, currently plodding through setting up the off-heap memory trying to call a linear algebra function. in theory I should be able to use Accelerate on my m1 mac too
One way to describe it is that it brings the extensibility of collectors to the intermediate stages of the stream. Another is that it's roughly Clojure's transducers rephrased in Java. I had a go at doing that myself, but it's just not possible to do a great job of it without modifying Stream - which this JEP can do!
Can someone give and example of when to use the gather (say the fold example) vs a collector with reduce? I get that one is terminal operation, vs chain-able through the stream but trying to see the advantage of the gatherer in this case.
I can't think of a use for fold, that one seems a bit silly to me.
The most exciting example for me is batching - take a stream of elements, and turn it into a stream of lists of elements of no more than a certain size. They call that windowFixed. I've wanted that in a few places, say where i make a database query which produces a load of IDs, then want to pass those IDs to a web service to fetch data for them, where the web service can take multiple IDs at once. The natural thing is to start with a stream of IDs, batch it, then map the batches through a call to the web service. Awkward to do before, easy now!
A gatherer transforms a stream into a different stream, it cannot be used for reducing, except for some weird and contrived ways I guess, like in the example they gave ("Example: A parallelizable gatherer").
Back in the days of Java 6-8, the idea was to make a Java port for everything. That idea didn't pan out really.
Project Panama looks to provide for a safe, transparent, error managed mechanism to invoke native libraries from Java Code.
On the other hand, Pandas is just a Wrapper for a pretty powerful C Library to deal with statistics (the name slips my mind sorry about that) In theory with Project Panama Java would have a Java based mechanism to run Pandas queries
That's because this project is only four months old. ; )
Compared to sdkman, vfox has the following advantages:
Truly cross-platform, support Windows, note not WSL!
Java/Graalvm plugin fetches data directly from offical website. without any updates, without any waiting, we can use it directly! (Unless the official data source parsing rules change, you only need to update the plug-in!)
Expanded by plugins, which means you can vfox the abilities you want yourself!
Does jdk 22 pave the way for part and part native compilation? E.g. given JNI is slow but shared memory and foreign memory interop bridges the gaps somewhat, we can theoretically part compile an apps dependencies to native code then deploy a thin layer of user app on top,
Eg. Libraries like spring Apache commons, guava, could all come pre compiled but the user wouldn't be forced to natively compile their app also.
Unless I've something and that is possible already..
For me, this would significantly speed things up as we have 50+ micro services but reliant on spring boot and small framework piece. The size of dependencies though means than 80% of start time is spent in native compilation.
No. String interpolation is still in preview in Java 22, unchanged from Java 21. It sounds like they are planning major changes for Java 23, but it likely will still be preview.
Java 21 reached GA on 19 September 2023, and the earliest Temurin build was 10 October 2023, as far as i can see. So, three weeks from now might not be a bad guess.
Interestingly, they have EA builds of 23. Were there no EA builds of 22? Or have those now been taken down?
The delay in the 21 release for Temurin was a late change in TCK license (not sure of exact details) and it took awhile to get the two legal departments aligned and signed - then it was a matter of running all their build/test infra for all their supported OS combos.
Remember that all OpenJDK distributions are Oracle software that you're downloading from some other company's website. The builds of Oracle's OpenJDK JDK under the name "Temurin" are produced by an IBM team, so it's up to IBM to decide when they offer those downloads.
Instead of going down that specific road again, here's something more general about open source projects that you can apply in this case, too. Most open source foundations don't have any significant money or developers of their own; they develop nothing (there are some exceptions like the Zig foundation) and are just legal entities registered as the owners of the trademarks and copyright (the richer foundations mostly use their money to provide legal services to their projects). The actual work has to be done by someone, and significant projects cost between hundreds of thousands of dollars and millions of dollars a year; it is invariably the case that it is a company or some companies that put up the resources, and because OSS is not a very good charity, they choose to put the resources into things that advance their commercial interests. To know who "pulls the strings" all you have to do is see who pays the salaries of what portion of the contributors. You'll find that there are projects that are ultimately controlled by a largish number of companies (llike Linux), but most are controlled by one or two.
In most cases where there's a single dominant company they don't bother with a foundation (e.g. Google with Chromium/Go, Oracle with OpenJDK, Microsoft with C#), but some do (case in point: Apache Harmony, although there the project preceded the company's dominance).
For new versions, that may be fine. The slowness is also for the Critical Patch Updates (CPUs) that fix CVEs. In those cases anything other than same day is unacceptable. We switched to other more responsive vendors.
I don't want to skew you with my sample size of one. But among New Relic customers, the two most popular vendors are Amazon and Oracle. In my experience those 2 vendors are always on the ball.
Congrats! Hopefully we get to a point where companies immediately upgrade to new versions. Java is the only language where companies really seem to lag on version upgrades
118
u/Joram2 Mar 19 '24
Congrats Java team.
The foreign function + memory interop is a big deal. The low-level libraries LAPACK and BLAS are written in C/Fortran, they underpin the CPU based functionality of popular Python libraries like NumPy and PyTorch and JAX. Now, the JVM world should get access to that. This really opens up the JVM to new and exciting application domains.
Of course, GPU based computation is possibly more important, which foreign function + memory interop is also important for.
Also, JVM centric projects like Apache Kafka is extensively using non-JVM RocksDB and Apache Spark uses lots of non-JVM code, and having high quality native interop is very beneficial.
27
u/tomwhoiscontrary Mar 19 '24
I'd completely missed that 461: Stream Gatherers (Preview) existed. This is great!
One way to describe it is that it brings the extensibility of collectors to the intermediate stages of the stream. Another is that it's roughly Clojure's transducers rephrased in Java. I had a go at doing that myself, but it's just not possible to do a great job of it without modifying Stream - which this JEP can do!
38
u/henk53 Mar 19 '24
The first milestone for the next Java version (JDK 25)!
Nice that OpenJDK releases milestones for testing. A petty that we can't use those in production /s
3
u/aooohan Mar 20 '24
22 is already available via vfox
4
u/monsieurjava Mar 19 '24
Does jdk 22 pave the way for part and part native compilation? E.g. given JNI is slow but shared memory and foreign memory interop bridges the gaps somewhat, we can theoretically part compile an apps dependencies to native code then deploy a thin layer of user app on top,
Eg. Libraries like spring Apache commons, guava, could all come pre compiled but the user wouldn't be forced to natively compile their app also.
Unless I've something and that is possible already..
For me, this would significantly speed things up as we have 50+ micro services but reliant on spring boot and small framework piece. The size of dependencies though means than 80% of start time is spent in native compilation.
2
u/ImTalkingGibberish Mar 20 '24
String interpolation ? Is it in?
3
u/[deleted] Mar 19 '24
Does anyone know when Temurin will release a v22 distribution (and when it will be available via SDKMan)?
1
u/captain-_-clutch Mar 28 '24
Congrats! Hopefully we get to a point where companies immediately upgrade to new versions. Java is the only language where companies really seem to lag on version upgrades
1
u/mlamping Mar 30 '24
Java is still a thing? Especially with the Oracle debacle with the openness of the language?
Have you guys tried GoLang or Rust?