dynamic-language-runtime

What's the memory footprint of the DLR?

百般思念 提交于 2020-01-03 15:20:10
问题 I'm considering making limited use of C#'s dynamic keyword. My initial time trials were astonishing - a performance hit of less than a second for 100,000 iterations (likely due to DLR caching). I don't have access to a memory profiler, though, and Eric Lippert wrote: Then it starts up the DLR [...] The DLR then starts up a special version of the C# compiler... What's the memory footprint of this, and is it unloaded when the dynamic code is garbage-collected? 回答1: is it unloaded when the

C# 3.5 DLR Expression.Dynamic Question

强颜欢笑 提交于 2020-01-01 14:23:17
问题 I have inherited a small scripting language and I am attempting to port it to the DLR so that it is a little easier to manage. So far it has been fairly straight forward. I have run into a problem though attempting to dynamically call members of a variable. The current language runs on .NET and uses a parsing loop and reflection to do this, but I was hoping to get away from that. Here is an example of the script language: string $system1RemoteUri; string $dbconnection = $config

C# 4.0: casting dynamic to static

落爺英雄遲暮 提交于 2019-12-31 21:22:09
问题 This is an offshoot question that's related to another I asked here. I'm splitting it off because it's really a sub-question: I'm having difficulties casting an object of type dynamic to another (known) static type. I have an ironPython script that is doing this: import clr clr.AddReference("System") from System import * def GetBclUri(): return Uri("http://google.com") note that it's simply newing up a BCL System.Uri type and returning it . So I know the static type of the returned object.

What's the best way to embed IronPython inside my C# App?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 01:25:32
问题 I have an application used by pretty tech-savey people and they want small island of programmability so I've used embedded Iron Python. However, since IronPython 2.0 Eval() doesn't work any more. Specifically I can't both load modules and inject local variables. There is a work around where I can still call Execute(), print out my answer and listen to StandardOut, but then it comes out as a string and I've lost the type. Not a disaster for a long, but a huge pain for more complex objects.

accessing dynamic objects in F#

吃可爱长大的小学妹 提交于 2019-12-24 00:03:18
问题 I'm parameterizing some linq queries, and ended up using dynamic linq. Initially I had some trouble extracting the data from the dynamic objects it created but I managed to extract it using FSharp. InteropDynamic, regarding a better way to parameterize linq queries I plan to post another question. My question is . Is this the best way to access dynamic linq and/or dynamic objects (memory and speed wise?). When I first use it FSI gives me a message. Binding session to '..\..\packages\Dynamitey

Running IronPython object from C# with dynamic keyword

被刻印的时光 ゝ 提交于 2019-12-23 04:03:47
问题 I have the following IronPython code. class Hello: def __init__(self): pass def add(self, x, y): return (x+y) I could make the following C# code to use the IronPython code. static void Main() { string source = GetSourceCode("ipyth.py"); Engine engine = new Engine(source); ObjectOperations ops = engine._engine.Operations; bool result = engine.Execute(); if (!result) { Console.WriteLine("Executing Python code failed!"); } else { object klass = engine._scope.GetVariable("Hello"); object instance

Running IronPython object from C# with dynamic keyword

非 Y 不嫁゛ 提交于 2019-12-23 04:03:06
问题 I have the following IronPython code. class Hello: def __init__(self): pass def add(self, x, y): return (x+y) I could make the following C# code to use the IronPython code. static void Main() { string source = GetSourceCode("ipyth.py"); Engine engine = new Engine(source); ObjectOperations ops = engine._engine.Operations; bool result = engine.Execute(); if (!result) { Console.WriteLine("Executing Python code failed!"); } else { object klass = engine._scope.GetVariable("Hello"); object instance

C# application works much slower using compiled IronPython standard library

て烟熏妆下的殇ゞ 提交于 2019-12-22 11:22:43
问题 When I load modules from standard library as source .py files in this application, elapsed time after end equals approximately 4 seconds: Stopwatch watch = Stopwatch.StartNew(); ScriptEngine engine = Python.CreateEngine(); ScriptScope scope = engine.CreateScope(); ICollection<string> paths = engine.GetSearchPaths(); paths.Add(@"C:\Users\Montgomery1944\Documents\Libs\IronPython-2.7.1\Lib"); engine.SetSearchPaths(paths); ScriptSource source = engine.CreateScriptSourceFromString( @"from

Bug in the dynamic language runtime in combination with IIS 7.5

不想你离开。 提交于 2019-12-22 09:40:18
问题 I apologize for this question length, but I think you'll all find it worth it. Before I begin, let me say that I was really trying to produce an isolated console application, but sadly that proved impossible. The bug does not happen in a console app. It doesn't happen in a self-contained ASP.NET app. It only happens when run within IIS 7.5 on Windows 7. The error seems related to the dynamic language runtime as it involves the combination of a __TransparentProxy (via WCF) and a dynamic

How to refer self-contained C# class library project with IronPython inside (Visual Studio 2010)

故事扮演 提交于 2019-12-22 09:17:35
问题 This question is kind of lengthy but I try to provide you with the details that I think is necessary to find the answer. I have a C# WPF solution (.Net 4) consisting of a main project, building a WPF windows app, which depends on a few class library projects residing in the same Visual Studio 2010 solution. One of the class library projects encapsulates some previously developed python code that I want to make use of through IronPython and Microsoft Dynamic Language Runtime. I would like the