-
Notifications
You must be signed in to change notification settings - Fork 347
Use Vector API in the Java Extension #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…fter refactoring the vectorized class.
194ba01
to
15c7187
Compare
Using hsdis to examine the generated assembly I can verify that on my Macbook Air the Hotspot C2 Compiler does indeed use Neon instructions.
|
@samyron OMG I look away for a few days and you just go and do it! Bravo! I'll have a look at these changes soon and see if I can offer any suggestions. This API is still a bit of a moving target, but I think we can work around that with a little Ruby magic here and there. I will also point the Vector API folks at this PR so they can see what we're doing and provide additional input. Amazing work! |
I've posted a thread to the panama-dev list here: https://mail.openjdk.org/pipermail/panama-dev/2025-July/021080.html |
PLEASE DO NOT MERGE
Overview
This PR uses the jdk.incubator.vector module as mentioned in issue #739 to accelerate generating JSON with the same algorithm as the C extension.
The PR as it exists right now, it will attempt to build the
json.ext.VectorizedEscapeScanner
class with a target release of16
. This is the first version of Java with support for thejdk.incubator.vector
module. The remaining code is built for Java 1.8. The code will attempt to load thejson.ext.VectorizedEscapeScanner
only if thejson.enableVectorizedEscapeScanner
system property is set totrue
(or1
).I'm not entirely sure how this is packaged / included with JRuby so I'd love @byroot and @headius's (and others?) thought about how to potential package and/or structure the JARs. I did consider adding the
json.ext.VectorizedEscapeScanner
to a separategenerator-vectorized.jar
but I thought I'd solicit feedback before spending any more time on the build / package process.Benchmarks
Machine M1 Macbook Air
Note: I've had trouble modifying the
compare.rb
I was using for the C extension to work reliability with the Java extension. I'll probably spend more time trying to get it to work, but as of right now these are pretty raw benchmarks.Below are two sample runs of the real-world benchmarks. The benchmarks are much more variable then the C extension for some reason. I'm not sure if HotSpot is doing something slightly different per execution.
Vector API Enabled
Vector API Disabled
master
as of commitc5af1b68c582335c2a82bbc4bfa5b3e41ead1eba
Observations
activitypub.json
andtwitter.json
seem to be consistently faster with the Vector API enabled.citm_catalog.json
seems consistently a bit slower andohai.json
is fairly close to even.