IronSchemeLanguageProvider now has internal constructors

Oct 7, 2011 at 3:47 PM

I came across this comment ("IronSchemeLanguageProvider now has internal constructors") in the recent discussion on "Type initialization exception on Eval". It appears to break the example scenario for "How to evaluate scheme code from C#" since making IronSchemeLanguageProvider internal means you can't call new on it.

My primary issue that uncovered this problem is that when using the IronScheme extension method Eval() on String, it takes ~8 seconds to instantiate the IronScheme engine (.NET 4 on 64-bit Win7 on 2.4GHz Core i5). This is in sharp contrast to starting the IronScheme console from the command line which starts in ~1 second. I was hoping that the code from "How to evaluate scheme code from C#" would lead to an improvement in startup time, but since I can't instantiate an IronSchemeLanguageProvider I can't tell.



Oct 7, 2011 at 4:28 PM
Edited Oct 7, 2011 at 4:29 PM

I seem to have found the "workaround" in the source code under "EmbeddingConsole":

LanguageProvider slp = ScriptDomainManager.CurrentManager.GetLanguageProvider(typeof(IronSchemeLanguageProvider)); 
ScriptEngine se = slp.GetEngine();
se.Evaluate("(load \"" + modelFileName + "\")");

This appears to cut 75-80% of the load time out.

Oct 9, 2011 at 7:31 AM


I have been thinking why there would be a such a slow since I saw your first message, but I am still stumped why the one is slower as they effectively run the same code.

The only possible reason could be that you tried using the one (slow) with 32-bit app and the other (fast) using a 64-bit app due to libraries that have been NGEN'd during installation. By default, it only NGEN's for your current platform (perhaps I should change that on 64-bit OS?).

There are too many to factors to say if this is the case indeed. 

For ease of use using the Eval extension is definitely better. 


"(load {0})".Eval(@"c:\foo\")

That will actually place the argument (not the string) in a variable 'referenced' by {0}.

Let me know if NGEN was the issue.