Skip to content

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

Merged
kddnewton merged 2 commits intoruby:mainfrom
andreaTP:chicory-redline
Apr 15, 2026
Merged

[preview] use chicory-redline in java wasm#4071
kddnewton merged 2 commits 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.

@andreaTP andreaTP marked this pull request as ready for review April 14, 2026 22:46
@andreaTP
Copy link
Copy Markdown
Contributor Author

Logger removed, redline 0.0.2 released and ready to merge, please verify everything carefully as this is the first real-world usage of redline I'm aware of 😅

@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 15, 2026

I'll push some snapshots through our CI and see how it looks.

@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 15, 2026

I flushed out all maven caches for the wasm_prism branch of JRuby and restarted the ruby/spec language specs job here:

https://github.com/jruby/jruby/actions/runs/24418746698/job/71372429347

I'll also push an update to add a run of the core Ruby specs with prism enabled, but the language specs should cover 99% of all language constructs.

Assuming nothing changes in the status of this job, we are good to merge this and I can do a round of releases to get it into JRuby master.

@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 15, 2026

Core spec run with Prism enabled:

https://github.com/jruby/jruby/actions/runs/24430230203/job/71372858599

I'm not sure if @enebo has finished getting this green, so if it's red that should not invalidated the new redline wasm build.

@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 15, 2026

Language specs are as green with redline chicory as they were with chicory AOT!

@kddnewton This can be merged now, and I'll push a 0.0.2 release.

@headius
Copy link
Copy Markdown
Contributor

headius commented Apr 15, 2026

Only failure in the core specs was a missing parser warning; we're probably just not calling the right hook. Does not indict the redline build because I believe it failed before.

Copy link
Copy Markdown
Collaborator

@kddnewton kddnewton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great

@kddnewton kddnewton merged commit 1a7c3d9 into ruby:main Apr 15, 2026
68 checks passed
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.

3 participants