Virtual Threads vs Vert.x Event-Loops
Edited to add Postscript section after feedback.
Introduction
In the article about Jactl Continuations and Virtual Threads in Java 8, I discussed the continuation-based mechanism that Jactl uses to support blocking operations in Java versions that don't support Virtual Threads. The continuation mechanism provides support for suspending a script performing a long-running operation, and then resuming it once the operation completes, exactly where it left off, all without blocking the event-loop thread.
As far as the script writer is concerned, they do not need to know whether an operation is a blocking one or not.
Jactl provides a Virtual Thread-like way for scripts to have perfectly natural code without needing to
be concerned about async/await or other async programming mechanisms like Futures, Promises, or
callbacks.
The article also provided a benchmark showing the performance impact of suspending and resuming scripts when running on Vert.x event-loop threads. Jactl provides a way to disable this mechanism for applications running on more modern versions of Java and wanting to take advantage of the built-in Virtual Threads in Java. I wanted to compare the performance of the two approaches.
This article showcases a new benchmark that compares the Jactl/Vert.x approach with Jactl/Virtual Threads and presents the results from running on both Java 21 and Java 25.
