Created
January 23, 2018 15:07
-
-
Save jkotas/2c6d95a208accb77b50fbc0e4fdd28f1 to your computer and use it in GitHub Desktop.
Interop overhead microbenchmark
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
| using System; | |
| using System.Security; | |
| using System.Runtime.InteropServices; | |
| class Test | |
| { | |
| [DllImport("kernel32.dll")] | |
| [SuppressUnmanagedCodeSecurityAttribute] | |
| extern static int GetTickCount(); | |
| static void Main() { | |
| int start = Environment.TickCount; | |
| for (int i = 0; i < 1000000000; i++) | |
| GetTickCount(); | |
| int end = Environment.TickCount; | |
| Console.WriteLine(end-start); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment