Performance Issue using CSharpCompiler Class RRS feed

  • General discussion

  • Hi There, it's the first time i come here, and i hope you guys can help me!

    I'm having a HUGE problem using CSharpCompiler Class when it is called thousands of times is a same exe! and it calls "PERFORMANCE". Well, here's the thing:

    I have a framework that compiles a formula, wich is configured by the user. It has a friendly interface, that allows the user to build his own formula structure, using the fields of a specific database.

    The solution was made with a WindowsForms exe, and it calls this formula framework that does the dirty job, formats the formula that was built by the user in a friendly UI, executes it using the CSharpCompiler Class and spits out the result of it, wich is caught back by the exe and recorded in a SQL db.

    Well. this process is repeated THOUSANDS of times, for each formula that is registered by the user, in this same exe. AWESOME! if the memory was cleaned up for each compiling call, but it's just not what happens, it accumulates the memory for each call in the exe scope.

    if you guys know a way to implement this solution without using 2 exe programs, i'd really appreciate the help!!

    Thanks for now!
    Tuesday, November 18, 2008 7:48 PM

All replies

  • See my answer here.


    Yes, this is a VB.NET group - but the solution works just as well from C#.  Maybe you can adapt it to your needs...

    Tom Shelton
    Tuesday, November 18, 2008 10:05 PM
  • Thanks very much for your reply Tom!...i'd really try to apply your JScript solution, and i'll let you know about the results of it!!
    Wednesday, November 19, 2008 8:09 PM
  • It just worked perfectly!!...i used the JScript solution, and i got an extraordinary result!...my process was taking about 7 hours to finish it's tasks...after the performance update using your idea i got my time down to 49...SECONDS!! amazing.

    Here's a lesson learned, never use CSharpCompiler Class to a runtime compilation that is called thousands of times. :)

    Thanks very much for your help Tom. I hope it can help others with this problem too.
    Monday, November 24, 2008 4:55 PM