-
Hello team, Since on my app's side the evaluation is done already in a separate Thread, I would like to know whether it is possible to tell Truffle to avoid opening a new one but use the current instead. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi! Yes, you can perform the compilation on the main thread by setting the The compilation is expected to be performed only once per polyglot If your scripts are short-lived and very simple, it can make sense to turn off compilation entirely by setting the If the compiler uses too much CPU resources, you can, for example, reduce the number of compiler threads by setting More info on setting options: https://www.graalvm.org/latest/reference-manual/polyglot-programming/#polyglot-options Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Hello @chumer, bothering you with this subject again. I finally implemented a caching mechanism for Hence my question: is it possible to create a Thanks! |
Beta Was this translation helpful? Give feedback.
Hi!
Yes, you can perform the compilation on the main thread by setting the
engine.BackgroundCompilation
option tofalse
. However, we do not recommend doing this, as it can cause latency spikes in the evaluation of code (up to seconds). I have yet to encounter a use case where I would recommend turning off background compilation.The compilation is expected to be performed only once per polyglot
Source
, so if you are running in a long-running server process, I would recommend keeping background compilation on, but at the same time making sure code caching across contexts is enabled, so scripts only need to be compiled once per server process. See here for instructions:https://www.graalvm.…