Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile and execute C# code from string at run time
#7
Need some work, but I don't have enough motivation.
For C# code that does not change frequently, create and use a dll instead. A cache feature would do it automatically. For C# code that changes frequently, caching does not make much sense.

`Compile` is slow the first time in a script, because of JIT-compiling the compiler itself (the codeanalysis dlls). To warm up, call `Compile` earlier in the script, with any C# code.

In next LA will be possible to make the startup faster 2 times, eg 700 ms -> 350 ms. Next LA will use .NET 10. Its C# compiler dlls from the SDK start faster. Will need just to change the first line (dll paths).


Messages In This Thread
RE: Compile and execute C# code from string at run time - by Gintaras - 12-13-2025, 07:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)