Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 666057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:46:36+00:00 2026-05-13T23:46:36+00:00

I am writing code to performance test a web site. I have the following

  • 0

I am writing code to performance test a web site. I have the following code:

        string url = "http://xxxxxx";
        System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();

        System.Diagnostics.Stopwatch totalTime = new System.Diagnostics.Stopwatch();
        totalTime.Start();

        for (int i = 0; i < 10; i++)
        {
            stopwatch.Start();
            WebRequest request = HttpWebRequest.Create(url);
            WebResponse webResponse = request.GetResponse();
            webResponse.Close();
            stopwatch.Stop();
            textBox1.Text += "Time Taken " + i.ToString() + " = " + stopwatch.Elapsed.Milliseconds.ToString() + Environment.NewLine;
            stopwatch.Reset();

        }

        totalTime.Stop();
        textBox1.Text += "Total Time Taken = " + totalTime.Elapsed.Milliseconds.ToString() + Environment.NewLine;

Which is giving the following result:

Time Taken 0 = 88
Time Taken 1 = 161
Time Taken 2 = 218
Time Taken 3 = 417
Time Taken 4 = 236
Time Taken 5 = 217
Time Taken 6 = 217
Time Taken 7 = 218
Time Taken 8 = 409
Time Taken 9 = 48
Total Time Taken = 257

I had expected the total time to be the sum of the individual times. Can anybody see why it is not?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:46:37+00:00Added an answer on May 13, 2026 at 11:46 pm

    Use TotalMilliseconds instead of Milliseconds and try your test again. Your results aren’t what you think they are.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a WPF chart and use Visuals for performance. The code looks
This is my code: // Start performance test clock assert((start=clock())!=-1); // Some reading and
Throwing an exception is costly in terms of writing good performance code. But what
I'm currently working on some performance critical code, and I have a particular situation
I'm driving a web services load test using a system of WSF, VBS and
When writing code do you consciously program defensively to ensure high program quality and
After writing code to populate textboxes from an object, such as: txtFirstName.Text = customer.FirstName;
While writing code in a file that would comprise of PHP, HTML, CSS &
While writing code, it is pretty common to request a page with an appended
When writing code in an Eclipse project, I'm usually quite messy and undisciplined in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.