Creating Objects - Round 3


Ayende has been discussing the different ways of actually creating objects in .NET and the perf cost associated to each of them.  I thought I'd add to the mix one more method, using the DLR.  I've talked to several people who have identified concerns with the speed of the DLR so I found the results rather interesting.  The context is still the same, identify the time it takes to construct one million Created instances. The delegate: delegate Created CreateInstance(int num, string name); The structure: public class Created { public int Num; public string Name; public Created(int num, string name) ...

DLR Hosting Services


I was poking around within the DLR code that was release yesterday within the IronPython Alpha release and I came across the Script class which allow local hosting of a script. Given a language provider you can then execute a block of code. Internally the ScriptEnvironmentSetup loads 4 LanguageProviderSetup classes currently IronPython.Hosting.PythonLanguageProvider Microsoft.JScript.Compiler.Hosting.LanguageProvider Microsoft.VisualBasic.Scripting.Hosting.VisualBasicLanguageProvider Ruby.Hosting.RubyLanguageProvider Unfortunately it appears they are only including the IronPython.Hosting.PythonLanguageProvider with this current release. A quick example of what you can do, the Script class is a wrapper around the ScriptDomainManager: using System; using Microsoft.Scripting; namespace IronPythonScriptHost { class Program { static void Main(string[] args) { string code = "print \"Hello\"...

DLR and IronRuby


Today at Mix the DLR was announced along with Silverlight. IronRuby is on the list to be one of the languages that will make the initial release under the DLR. If you're interesting in poking around with the early bits of the DLR, check the 2.0 Alpha release of IronPython. Hammett, any chance MonoRail is going to take advantage of these new features/languages?