Skip to content

Turbo Mode#40

Merged
gbenroscience merged 18 commits intomasterfrom
methd-handles
Mar 18, 2026
Merged

Turbo Mode#40
gbenroscience merged 18 commits intomasterfrom
methd-handles

Conversation

@gbenroscience
Copy link
Owner

ParserNG, in this series of commits has been given a turbo mode which is enabled by the usage of MethodHandles.
This turbo mode has 2 parts: One for Matrix Algebra and one for scalar computations, statistics and variable arithmetic etc.

…apable of handling both complex scalar calculus and heavy linear algebra with minimal GC pressure
…erNG's full suite of functions with sub 100ns latency
…ctions like tri_mat(M) and replacing them with anon1, anon2 etc. This is a breaking change. ParserNG will henceforth not accomodate that behaviour again
@gbenroscience gbenroscience merged commit 0da76ef into master Mar 18, 2026
0 of 6 checks passed
@gbenroscience gbenroscience deleted the methd-handles branch March 18, 2026 22:31
@judovana
Copy link
Contributor

The GHAs are not running ("billing issue" .. how come on personal account?). Manual testing went fine? How about mvn release?-)
Was the method handle really so great improvement? Were you able to measure it? Nice set of commits though. TY!

@gbenroscience
Copy link
Owner Author

Hi @judovana, I had some time on my hands, so I decided to fulfill my promise on updating ParserNG for speed.
The normal mode is by far faster now, will plot graphs very smoothly. Beats exp4J and com.expression.parser on every benchmark.
Its about 1.5x slower than Janino though, but by far more fully featured than it.

The Turbo Mode:
Beats the normal mode, and everything slower than the normal mode on every benchmark.
Beats Janino(the so-called gold standard) on most expressions(constant expressions and single variable expressions and multivariable expressions that are constant heavy or single variable heavy)
On balanced multi variable expressions however, Janino is 6ns to 40ns faster than the turbo mode.
Still planning some updates to see if that hurdle can be cleared.

And yes MethodHandles are really something in JDK 17+

The tests:
I have done all releases on maven central up to version 1.0.1, currently.
All tests pass on my own computers, but I think tests do not pass on Github perhaps because of actions that require some server resources?
Would be nice if you could look into this.. Thanks. I am sure your app will benefit from the speed updates!
Enjoy

@gbenroscience
Copy link
Owner Author

As to the measurements, I am targeting another release soon.
Will show you updated benchmarks later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants