Visual studio feeds

All Visual Studio blogs in one place

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Google+

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Search

Do You Know The Costs Of Garbage?

AddThis Social Bookmark Button
If you want to write scalable applications with a high throughput you need to take care of good data structure design to make your application scale. If you want to read for example 200 MB data from a file and process it you can finish it in 5 or 30s. To be on the 5s side it is educational to see how fast you actually can get. To measure the raw disc performance I do read the file into a pre allocated byte array. [Test]
public void ReadFile_Store_In_ByteArray()
{

    var sw = Stopwatch.StartNew();
    int read = 0;
    int numRead = 0;
    using (FileStream rStream = new FileStream(TestData, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 4096, FileOptions.SequentialScan))
    {
        byte[] bytes = new byte[210 * 1024 * 1024];         while ((numRead = rStream.Read(bytes, read, 4096)) > 0)
        {
            read += numRead;
       ...(Read whole news on source site)

Home : Blog List : Alois Kraus : Do You Know The Costs Of Garbage?