Croway opened a new pull request, #26310: URL: https://github.com/apache/camel/pull/26310
`JavaScriptHelper.newContext()` built a GraalJS `Context` without a shared `Engine`, so every evaluation created a private engine, re-parsed the script and allocated ~860 KB; the `Source` was rebuilt every time as well. Following the camel-python3 pattern: `JavaScriptLanguage` becomes a `Service` owning one lazily created `Engine` (closed on stop); contexts are still created per evaluation, with `.engine(shared)` and the same access options as before; the `Source` is cached per script text; one INFO line at engine creation reports interpreted mode (the `engine.WarnInterpreterOnly` option moved to the engine builder, same value); JS objects, arrays, `Map`, `Set` and `Date` returned by a script are materialized before the `Context` closes (on main `o.as(Object.class)` returned proxies bound to a closed context, which threw on first access). **Measured.** Expressions 1.8× faster, 1-thread route 1.8×, 8-thread 5-minute load 4,697 → 15,006 msg/s (3.2×) with 1.77 MB → 323 KB per message. One reading to look at: the 8-thread JMH route read 0.67× with the shared engine (p99 2.7 → 4.8 ms), so the shared engine serialises something under concurrency in interpreted mode. 14 tests (9 new: concurrency, stop/start, two contexts, result materialization). 🤖 Generated with [Claude Code](https://claude.com/claude-code) _Claude Code on behalf of Croway_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
