Skip to content

[preview] use chicory-redline in java wasm#4071

Draft
andreaTP wants to merge 1 commit intoruby:mainfrom
andreaTP:chicory-redline
Draft

[preview] use chicory-redline in java wasm#4071
andreaTP wants to merge 1 commit intoruby:mainfrom
andreaTP:chicory-redline

Conversation

@andreaTP
Copy link
Copy Markdown
Contributor

@andreaTP andreaTP commented Apr 8, 2026

This project was one of the biggest use-cases I attempted to tackle with the effort behind chicory-redline.

On my machine I have a great perf improvement, the integration should be safe in the sense that it gracefully fallback to Panama on Java 25+, jffi on Java 11+, pure chicory bytecode on unsupported architectures.

Happy to hear any feedback!

cc. @headius @enebo

@andreaTP
Copy link
Copy Markdown
Contributor Author

andreaTP commented Apr 8, 2026

Perf change:
on main: https://github.com/ruby/prism/actions/runs/23852645959/job/69536791724#step:9:78

Elapsed: 298
Elapsed: 272
Elapsed: 255
Elapsed: 242
Elapsed: 239
Elapsed: 224
Elapsed: 232
Elapsed: 226
Elapsed: 221

on this branch: https://github.com/ruby/prism/actions/runs/24157118380/job/70498905259?pr=4071#step:9:80

Elapsed: 25
Elapsed: 27
Elapsed: 24
Elapsed: 20
Elapsed: 24
Elapsed: 19
Elapsed: 22
Elapsed: 18
Elapsed: 19

@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 9, 2026

This is wild. Thank you for this crazy idea!

@Earlopain Earlopain marked this pull request as ready for review April 9, 2026 05:42
@Earlopain Earlopain marked this pull request as draft April 9, 2026 05:43
@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 14, 2026

Looking into this today.

@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 14, 2026

@andreaTP This is excellent. I have pushed snapshots all the way through to JRuby and can confirm that the performance is at least as good as our legacy Bison parser and only a little bit slower than a pure-native prism dylib.

Both @enebo and I agree this is sufficient performance for us to ship in JRuby 10.1. We may even be able to enable Prism by default if we are comfortable with the remaining functional gaps (our issue, not yours).

I did notice there's logging messages, though, and obviously these need to go away:

$ jruby -Xparser.prism -e 1
Apr 14, 2026 2:23:04 PM io.roastedroot.redline.UniversalInstance$Builder build
INFO: Using Redline native backend

@kddnewton Once @andreaTP fixes the logging messages and you are satisfied with the PR, it can be merged and I will release a 0.0.2 prism snapshot for us to ship with JRuby 10.1. The new Redline support will also mean we might not need to have a separate "prism-native" gem for JRuby and can just used the WASM artifacts directly. This is very exciting!

@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 14, 2026

Correction:

release a 0.0.2 prism snapshot

I will release a 0.0.2 artifact to Maven cental, since we can't ship with snapshot dependencies. prism-parser-wasm 0.0.2 will be based on this PR and use Chicory + Redline.

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