Created
March 24, 2017 21:25
-
-
Save shawnweisfeld/26d52a3de886600912bf6f5a67a07943 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
long numberOfBuckets = 10; | |
var fi = new FileInfo(path); | |
long bucketSize = fi.Length / (numberOfBuckets - 1); | |
Console.WriteLine($"Length: {fi.Length:N0}"); | |
Parallel.For(0, numberOfBuckets, (i) => { | |
long start = i * bucketSize; | |
long end = start + bucketSize -1; | |
Console.WriteLine($"{i}: {start:N0} -> {end:N0}"); | |
using (FileStream fs = File.OpenRead(path)) | |
{ | |
fs.Seek(start, SeekOrigin.Begin); | |
byte[] b = new byte[1024 * 1024]; | |
while (fs.Read(b, 0, b.Length) > 0) | |
{ | |
//Do Nothing; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment