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

  • Home
  • SEARCH
  • 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 836457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:59:02+00:00 2026-05-15T04:59:02+00:00

I am trying to performance test some code. I am using a stopwatch. When

  • 0

I am trying to performance test some code. I am using a stopwatch. When I output the number of milliseconds it always tells me 0 so I thought that I would try the number of ticks. I am seeing that the number of ticks is about 20 000 to 30 000. Looking at the MSDN at TimeSpan.TicksPerMillisecond it says that is 10 000 ticks per millisecond. In that case why are the elapsed milliseconds on my stopwatch not appearing as 2 or 3?

What am I missing? I have even outputed the result on the same line. This is what I get.

Time taken: 26856 ticks, 0 ms

And it is constant.

This is my code which I have running in a loop. I realize that I am creating a new stopwatch every time which isn’t very efficient but I don’t see how it could skew my results.

Dim SW = New Stopwatch()
SW.Reset()
SW.Start()
MethodCall()
SW.Stop()
Console.WriteLine(String.Format("Time to increase counters: {0} ticks, {1} ms", SW.ElapsedTicks, SW.ElapsedMilliseconds))
  • 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-15T04:59:02+00:00Added an answer on May 15, 2026 at 4:59 am

    Stopwatch ticks are different from DateTime Ticks.

    The length of a Stopwatch tick depends on the Stopwatch frequency (one tick is one second divided by the frequency, as described in the MSDN documentation for Stopwatch.ElapsedTicks.

    It could be argued that Stopwatch.ElapsedTicks was a poor choice of a name for this property because of the potential for confusion with DateTime ticks. I would have preferred something like ElapsedRawTicks, or some other suitable adjectival qualifier to hint that these are not standard Ticks.

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

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Says it right in the documentation publish_stream Enables your application… May 16, 2026 at 9:14 am
  • Editorial Team
    Editorial Team added an answer I assume in your code you are extending Thread, because… May 16, 2026 at 9:14 am
  • Editorial Team
    Editorial Team added an answer If you really want to read the whole file at… May 16, 2026 at 9:14 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm trying to optimize my C++ code. I've searched the internet on using dynamically
I have been trying to perform some OpenGL ES performance optimizations in an attempt
What would anyone consider the most efficient way to merge two datasets using Python?
I am trying to hydrate a list of ~400 business objects and the performance
I'm trying to perform an integration test via Watir and RSpec . So, I
I am trying to quickly process large images (about 2000x2000). I am using a
I have created a very simple application where I am trying to insert a
I need to build a Regex (.NET syntax) to determine if a string ends
here's a problem I've solved from a programming problem website(codechef.com in case anyone doesn't

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.