Skip to content

Instantly share code, notes, and snippets.

@weltkante
Created February 3, 2017 14:28
Show Gist options
  • Save weltkante/c2c7a3e0b9a37aa4e99575899e3c6f1f to your computer and use it in GitHub Desktop.
Save weltkante/c2c7a3e0b9a37aa4e99575899e3c6f1f to your computer and use it in GitHub Desktop.
script invocation performance
try
{
var script = CSharpScript.Create<int>("42", globalsType: typeof(Record));
int count = 0;
var start = DateTime.UtcNow;
var now = start;
for (;;)
{
for (int i = 0; i < 100; i++)
{
var result = await script.RunAsync(new Record());
count++;
}
now = DateTime.UtcNow;
var delta = (now - start).TotalSeconds;
if (delta > 10)
break;
}
MessageBox.Show($"Average milliseconds per call: {(now - start).TotalMilliseconds / count: 0.000}");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment