Replies: 1 comment 1 reply
-
Given that your js code snippet is trivial, I suspect that you're measuring mostly Context initialization overhead and thus not seeing the benefits of code caching. Context creation isn't free, but usually dominated by the JS code. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. I probably does not understand things around scripts caching well enough. Here is my "problem".
I have a very simple JavaScript script which just concatenates two strings. When I call this script in a loop of lets say 100 000 iterations, and in each iteration I use the same
Context
, then it's pretty quick.But when I want to use "engine sharing" instead, that means in each iteration create new
Context
but with sharedEngine
, then it is very slow.My understanding was, that the script evaluated in first (few) iterations would be parsed, optimized and cached in the engine, so each subsequent context would benefit from the optimizations/parsing in the first (few) iterations. But that does not seem to be true. Could you please clarify to me, how is it intended to work and why there is so big difference?
I have tested it with OpenJDK 21, but also with Graal VM 21/24. The behavior is more or less the same. Graal version 23.1.2, but also the 24.2.1 on JDK 24.
Here is the code which I used to "benchmark" it:
Beta Was this translation helpful? Give feedback.
All reactions