zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
459 stars 86 forks source link

Is Compilation Automatic? #104

Closed stonstad closed 3 years ago

stonstad commented 3 years ago

When is compilation performed for an expression? Is it automatically performed if caching is enabled, or must I manually compile expressions?

JonathanMagnan commented 3 years ago

Hello @stonstad ,

I'm not sure to 100% understand your question but I will try to answer it.

When you execute an expression,

So no, you do not have to manually call the compile. Our library is smart enough to do it. On a very big loop, the compiled method will always be faster than the execute method. However, using the Execute method is usually enough as checking if the compiled lambda exists or not is really fast.

Let me know if that answers your question.

Best Regards,

Jon

stonstad commented 3 years ago

Answered perfectly. Thank you Jon!