I am using .kts as config files in my project, and I have quite a number of such files.
The first time I load a .kts it takes about 10 seconds to complete. The second time it takes about 2 seconds. This is quite unsatisfactory as 10 seconds of the startup time is wasted on initializing .JSR223.
Of course some values can be cached, but it is not possible for my case as some of my config files (e.g. translation files) involve lambdas.
Is it possible to cache the compiled bytecode, or otherwise optimize this loading process? The only result I can find on Google is https://stackoverflow.com/q/48777423/3990767, which does not seem to provide any good solutions.