Skip to content

Instantly share code, notes, and snippets.

@alex-groshev
Created February 24, 2015 13:43
Show Gist options
  • Save alex-groshev/f1dc24fde2c7aa9f1ff3 to your computer and use it in GitHub Desktop.
Save alex-groshev/f1dc24fde2c7aa9f1ff3 to your computer and use it in GitHub Desktop.
How to use the LowLatency mode
private static void LowLatencyDemo()
{
GCLatencyMode oldMode = GCSettings.LatencyMode;
System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions();
try
{
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
// Run your code here...
}
finally
{
GCSettings.LatencyMode = oldMode;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment