Created
February 3, 2017 14:28
-
-
Save weltkante/c2c7a3e0b9a37aa4e99575899e3c6f1f to your computer and use it in GitHub Desktop.
script invocation performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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