Created
December 27, 2012 15:44
-
-
Save spetroll/4389176 to your computer and use it in GitHub Desktop.
This file contains 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
public static readonly int[] HR = new int[32487834]; | |
private static unsafe void Init() | |
{ | |
var lutFileInfo = new FileInfo(@"C:\Handranks.dat"); | |
if (!lutFileInfo.Exists) | |
{ | |
GenerateFile(); | |
} | |
Console.Write("Loading HandRanks.."); | |
var timer = Stopwatch.StartNew(); | |
using (var lutFile = new FileStream(@"C:\Handranks.dat", FileMode.Open, FileAccess.Read, FileShare.ReadWrite,4096)) | |
{ | |
var tempBuffer = new byte[32487834*4]; | |
lutFile.Read(tempBuffer, 0, 32487834*4); | |
fixed (int* pLut = HR) | |
{ | |
Marshal.Copy(tempBuffer, 0, (IntPtr) pLut, 32487834*4); | |
} | |
tempBuffer = null; | |
} | |
timer.Stop(); | |
Console.WriteLine(" done"); | |
Console.WriteLine("\t Time Required: {0}ms", timer.ElapsedMilliseconds); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment