Vector API use for JRuby's json library

Jatin Bhateja jatinbha.cloud at gmail.com
Mon Aug 4 16:20:07 UTC 2025


Following JMH micro-benchmark shows 50x improvement in JSON structural 
character lookup using new Vector.selectFrom API which can operate on 
128 byte lookup table.

https://github.com/ionutbalosin/jvm-performance-benchmarks/pull/105

I plan to explore and modify existing UTF8Validator and 
StructuralIndexer components of 
https://github.com/simdjson/simdjson-java library.

Best Regards,

Jatin


On 7/31/2025 8:33 PM, Charles Oliver Nutter wrote:
> The developer experimenting with vectors has been running 21, so I did 
> suggest to him recently to try newer releases or dev builds. I'm out 
> of office right now but hoping to spend some time in the next week 
> running this through a profiler to see if other missed optimizations 
> are interfering with the vectorized version of the code.
>
> I also pointed out the other vector-based json project to him that was 
> suggested by Daniel. I'm hopeful we can get more out of this than we 
> have seen so far once I can help profile and dig into optimized 
> results a little bit more.
>
> There are many other places in JRuby where we could use this, such as 
> for handling text transcoding. There may even be some Ruby language 
> constructs that could be vectorized by JRuby's compiler. I wish I had 
> more hours in the day to experiment with this!
>
> On Mon, Jul 28, 2025, 22:40 Paul Sandoz <paul.sandoz at oracle.com> wrote:
>
>     Hi Daniel,
>
>     Thanks for sharing. We have made progress optimizing the
>     rearrange/selectFrom operations for UTF-8 related uses cases. The
>     improvements were integrated into JDK release 24 [0].
>     Further optimizations are in flight for slice operations with
>     constant inputs [1], which I believe can simplify the referenced
>     code and may further boost performance, but we need to verify.
>
>     Charlie, what version of the JDK are you using?
>
>     Paul.
>
>     [0] https://openjdk.org/jeps/489
>     [1] https://github.com/openjdk/jdk/pull/24104
>
>>     On Jul 16, 2025, at 10:46 AM, Daniel Lemire <daniel at lemire.me> wrote:
>>
>>     Good day Charles,
>>
>>     The following link might be relevant :
>>
>>     https://github.com/simdjson/simdjson-java
>>
>>     - Daniel
>>
>>>     After seeing similar work done for the C version of the Ruby
>>>     json standard library, I suggested to the author that we could
>>>     do the same for JRuby using the Vector API. So he went and did it!
>>>
>>>     https://github.com/ruby/json/pull/824
>>>
>>>     The results are somewhat mixed; performance of some cases is
>>>     faster and other cases is slower. We would love to get input
>>>     from anyone on this list interested in seeing another real-world
>>>     use case for the Vector API.
>>>
>>>     I'm hopeful we can pump up these numbers with some additional
>>>     tweaking in JRuby and json.
>>>
>>>     *Charles Oliver Nutter*
>>>     /Architect and Technologist/
>>>     Headius Enterprises
>>>     https://www.headius.com
>>>     headius at headius.com
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20250804/afaa8b0f/attachment.htm>


More information about the panama-dev mailing list