Questions tagged [timing]

timing is a numerical measurement of the how long it takes to execute an instruction or series of instructions

Timing is a numerical measurement of the how long it takes to execute an instruction or series of instructions. See also .

To get a better understanding of performance of a given code, it should be measured at several problem sizes and empirical orders of growth calculated.

1396 questions
11
votes
2 answers

Timing with the Firebug Net Panel: What is the onload time?

I'm using the Firebug net panel to see response times. On the net panel's status bar, the summary is displayed as follows: 10 requests        90KB            10.22s (onload 6.57s) What does that onload time mean? Does it mean that once the content…
user504674
11
votes
2 answers

Best approach for dealing with time measures?

My goal is to write a framework for measuring method execution or transaction time and for processing the measurements, i.e. storing, analysis etc. Transaction may include calls to external systems, with synchronously or asynchronously waiting for…
Gerald Mücke
  • 10,724
  • 2
  • 50
  • 67
11
votes
2 answers

Flushing the cache to prevent benchmarking fluctiations

I am running the c++ code of someone to do the benchmarking on a dataset. The issue I have is that often I get a timing for the first run, and these numbers massively change (i.e. 28 seconds to 10 seconds) if I run the same code again. I assume this…
user3639557
  • 4,791
  • 6
  • 30
  • 55
11
votes
2 answers

Precise Linux Timing - What Determines the Resolution of clock_gettime()?

I need to do precision timing to the 1 us level to time a change in duty cycle of a pwm wave. Background I am using a Gumstix Over Water COM (https://www.gumstix.com/store/app.php/products/265/) that has a single core ARM Cortex-A8 processor running…
dillerj
  • 225
  • 2
  • 7
10
votes
4 answers

Precision timing in .NET

I've just seen this question, where one of the answers indicates that System.Diagnostics.Stopwatch should only be used for diagnosing performance and not in production code. In that case, what would be the best way to get precision timing in .NET?…
geofftnz
  • 9,954
  • 2
  • 42
  • 50
10
votes
1 answer

Timing in Scheme

I'm currently going through the Project Euler's problems and I'm solving them both in C# and Scheme (the Racket implementation). I know C# but I'm learning Scheme as I go along. Now, on top of having the correct results for the problems, I like to…
joce
  • 9,624
  • 19
  • 56
  • 74
10
votes
2 answers

Why does the call latency on clock_gettime(CLOCK_REALTIME, ..) vary so much?

I'm trying to time how long clock_gettime(CLOCK_REALTIME,...) takes to call. "Back in the day" I used to call it once at the top of a loop since it was a fairly expensive call. But now, I was hoping that with vDSO and some clock improvements, it…
JasonN
  • 1,339
  • 1
  • 15
  • 27
10
votes
3 answers

What's a clean way to time code execution in Java?

It can be handy to time code execution so you know how long things take. However, I find the common way this is done sloppy since it's supposed to have the same indentation, which makes it harder to read what's actually being timed. long start =…
Mark
  • 5,089
  • 2
  • 20
  • 31
10
votes
2 answers

Tensorflow: When are variable assignments done in sess.run with a list?

I have thought that variable assignments are done after all operations in a list given to sess.run, but the following code returns different results at different execution. It seems randomly run operations in the list and assign the variable after…
Sarah
  • 103
  • 1
  • 6
10
votes
1 answer

Jupyter/Ipython Notebook: How to time multiline segment of code?

The %time magic command allows you to conveniently time a single line of Python code. Can I also time a block of code without wrapping it in a function first? Is there an equivalent function that times an entire cell?
clstaudt
  • 21,436
  • 45
  • 156
  • 239
10
votes
3 answers

Mock timing in a context to create models with a field DateTimeField with auto_now_add=True

I'd like to mock timing so that be able to set certain time to a field of type DateTimeField with auto_now_add=True during my tests e.g: class MyModel: ... created_at = models.DateTimeField(auto_now_add=True) ... class…
trinchet
  • 6,753
  • 4
  • 37
  • 60
10
votes
1 answer

How to interpret the returned string of timeit

The following: timeit print("foo") returns something like: 100000 loops, best of 3: 2.35 µs per loop. I guess the 100000 relates to number argument of timeit. I don't understand what is best of 3 means and what is the time unit in use? In this case…
Dror
  • 12,174
  • 21
  • 90
  • 160
10
votes
2 answers

Speed difference for single line String concatenation

So I've been lead to believe that using the "+" operator to append Strings on a single line was just as efficient as using a StringBuilder (and definitely much nicer on the eyes). Today though I was having some speed issues with a Logger that was…
greedybuddha
  • 7,488
  • 3
  • 36
  • 50
9
votes
3 answers

Java timing accuracy on Windows XP vs. Windows 7

I have a bizarre problem - I'm hoping someone can explain to me what is happening and a possible workaround. I am implementing a Z80 core in Java, and attempting to slow it down, by using a java.util.Timer object in a separate thread. The basic…
PhilPotter1987
  • 1,306
  • 2
  • 12
  • 20
9
votes
5 answers

Can code running in a background thread be faster than in the main VCL thread in Delphi?

If anybody has had a lot of experience timing code running on the main VCL thread vs a background thread, I'd like to get an opinion. I have some code that does some heavy string processing running in my Delphi 6 application on the main thread. …
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227