Home

LInqpad Beta Util.Compile / Run Feedback

1. Does the Util.Compile/Run create a new instance of the script class each time it runs? Does it create a new process? In a high performance web server implementation, it would be nice to be able to control this. I would want to create a pool of 20 or so threads each attached with an instance of a compiled script. Then, only allow one HttpRequest thread to run on a script instance at a time. Each Run() would not create a new process. This would be controlled from the outside.

2. It would be nice to be able to get the method signature of the script's main(). This way the server could do some dependency injection. The app.config of the web could drive what parameter name/types get what kind of injections. Also, they may define more nature of the script. For example: "bool reentrant=true" allows simultaneous threads on the script.

Comments

  • Util.Run and Util.Compile use AppDomain isolation and not process isolation.

    Util.Run creates and destroys a new AppDomain each time you call it.

    If you use Util.Compile, each call to .Run will re-use the same AppDomain unless you set ReuseAppDomain to false. If two threads call .Run at once on the same compilation, LINQPad will create another AppDomain and you will end up with a "pool" as you describe. The pool is destroyed when you call Dispose on the QueryCompilation.

    I did consider providing an option for reflecting over the script's entry method, but it turned out to be more work than anticipated.

    Cheers
    Joe
Sign In or Register to comment.