473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Runtime expression engine

Hi there, I figured that there must be someone knew this-- I'm looking for a
runtime expression evaluation engine for our business rule engine. A typical
case is passing in a expression at runtime and engine return a bool/
calculated result.

I found some code on the internet, like
http://www.codeproject.com/csharp/runtime_eval.asp. My concern is more on the
performance side ,and I'm wondering if this is the right path to go.

Welcome any inspiriting thought!
May 26 '06 #1
5 5002
>From your description of what you want, this is overkill. All you want
is to evaluate mathematical expressions, no? You don't need to generate
arbitrary C# code and compile and run it, do you?

Question: will you be evaluating one expression many times over for
many inputs, or is it more likely that the expression to evaluate will
be constantly changing?

If you will be evaluating one expression over and over for different
inputs then maybe this runtime code compiler / generator will work for
you, since you would take a large hit up front to compile the C# code,
then it would run with maximum efficiency afterward.

May 26 '06 #2
Hi Bruce, my case is that I have mutiple expression need to evaluate on
different things and expression is quite different from one to the other. I'm
not sure about "overkill" since the expression requires flexibility.

Any thought?

"Bruce Wood" wrote:
From your description of what you want, this is overkill. All you want

is to evaluate mathematical expressions, no? You don't need to generate
arbitrary C# code and compile and run it, do you?

Question: will you be evaluating one expression many times over for
many inputs, or is it more likely that the expression to evaluate will
be constantly changing?

If you will be evaluating one expression over and over for different
inputs then maybe this runtime code compiler / generator will work for
you, since you would take a large hit up front to compile the C# code,
then it would run with maximum efficiency afterward.

May 26 '06 #3
What's your estimate of the workload for this expression engine?
There's only one other way I know how to do what you're trying to do in
..net and that's to write a function in jscript to take advantage of its
eval function. You could easily create a test app to compare the
performance of both techniques.
walter wrote:
Hi Bruce, my case is that I have mutiple expression need to evaluate on
different things and expression is quite different from one to the other. I'm
not sure about "overkill" since the expression requires flexibility.

Any thought?

"Bruce Wood" wrote:
From your description of what you want, this is overkill. All you want

is to evaluate mathematical expressions, no? You don't need to generate
arbitrary C# code and compile and run it, do you?

Question: will you be evaluating one expression many times over for
many inputs, or is it more likely that the expression to evaluate will
be constantly changing?

If you will be evaluating one expression over and over for different
inputs then maybe this runtime code compiler / generator will work for
you, since you would take a large hit up front to compile the C# code,
then it would run with maximum efficiency afterward.


May 26 '06 #4
I say overkill because the link you provided is for software that will
compile any C# code. It seems to me that you just want the expression
engine, not the full power of a programming language. That's what I
meant by "overkill".

May 26 '06 #5
I agree. The functionality in the link you posted is simple enough to
use. Plug it into your application and try it to see if it performs
well enough. Hunt for something different only if it's not performant.

May 26 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sbd! | last post by:
I had a problem with string which have some \ chars at the end of the string. For example: $String = "I want this **** out of here\\\\\\\\\"; I needed to remove it useing regular...
15
by: Frans Englich | last post by:
As continuation to a previous thread, "PyChecker messages", I have a question regarding code refactoring which the following snippet leads to: > > runner.py:200: Function (detectMimeType) has too...
6
by: Maurice LING | last post by:
Hi, I have the following codes: from __future__ import nested_scopes import re from UserDict import UserDict class Replacer(UserDict):
3
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
14
by: olekristianvillabo | last post by:
I have a regular expression that is approximately 100k bytes. (It is basically a list of all known norwegian postal numbers and the corresponding place with | in between. I know this is not the...
6
by: rorymo | last post by:
I have a regular expression that allows only certain characters to be valid in an xml doc as follows: <xs:pattern value="^*" /> What I want to do is also allow any unicode character that is...
25
by: allj | last post by:
When opening an mde users get a message (like) a date (Format(Now(),"yyyy") expression has a function that Microsoft Access cannot find. I checked all the references and re-registered them. Same...
5
by: Just Another Victim of the Ambient Morality | last post by:
This won't compile for me: regex = re.compile('(.*\\).*') I get the error: sre_constants.error: unbalanced parenthesis
3
by: Tre MoR | last post by:
Regular Expression: how match a whole word? Hi All, First of all, I’d express all my gratitude to all whom will help me about this topic. I have a question about the Regular Expression Engine,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.