Reusing compiled expressions from multiple threads...

Apr 9, 2009 at 11:39 AM
Hi Eugene,
First of all, thank you for the wonderful library.

Would it be possible for you to share how we could use the library to evaluate expressions from multiple threads when only variables change? We tried compiling new expressions per evaluation from multiple threads, but that seems to have performance issues. Now we create a single expression and using it from multiple threads. Only variables change per thread. Hence we had to lock the object for setting the variables and then evaluate the expression. This lock seems to be the bottle neck now. Is there a way to disassociate the compiled expression from the context and reuse it from multiple threads/expressions? Is there another way to do it?

Please advise. Thank you for your time.
Apr 10, 2009 at 10:10 AM
Edited Apr 15, 2009 at 1:16 PM
Maybe you use FLEE in wrong way - changing variable and recompiling expression every time takes a lot of time.
ExpressionOwner should helps you.
Apr 13, 2009 at 6:24 PM
I think the best way to implement this is to have a Clone method on an existing expression.  That way, you avoid the parsing/compilation overhead and you get a new expression context with its own set of variables.  If that sounds good, I'll try to implement it.

Apr 14, 2009 at 6:00 AM
Hi Eugene,
That sounds great. If we can Clone the expression reusing the compiled expression, it can be used across multiple threads with its set of variables, it would definitely improve performance. Would it be possible to implement it?
Apr 22, 2009 at 3:56 AM
It will be in the next release (probably this weekend)
Apr 23, 2009 at 6:02 PM
Hi Eugene,

Thank you. Will be waiting for the next update and try it out quickly.
Apr 26, 2009 at 2:50 AM
The clone method is now implemented in v0.9.25.0.
Apr 27, 2009 at 5:18 PM
Hi Eugene,

Thats great. Will download and try out immediately. Thank you.