Questions tagged [microbenchmark]

A microbenchmark attempts to measure the performance of a "small" bit of code. These tests are typically in the sub-millisecond range. The code being tested usually performs no I/O, or else is a test of some single, specific I/O task.

Microbenchmarking is very different from profiling! When profiling, you work with an entire application, either in production or in an environment very painstakingly contrived to resemble production. Because of this, you get performance data that is, for lack of a better term, real. When you microbenchmark, you get a result that is essentially fictional, and you must be very careful about what conclusions you draw from it.

Still, for either type always apply the old adage:
Premature optimization is the root of all evil.

485 questions
-2
votes
1 answer

Time units returned from timeit

At the first glance, Python documentation at https://docs.python.org/3.10/library/timeit.html# suggests that the time units returned by timeit with default parameters are the ones of the default timer time.perf_counter(), which are fractional…
Paul Jurczak
  • 7,008
  • 3
  • 47
  • 72
-2
votes
1 answer

How does Java's JIT compiler make bad code faster than good code?

Background This is a research that started from a Data Structures and Algorithms lecture. I apologize for the long background, but it is necessary to understand the question. The partitioning algorithms Lomuto and Hoare were benchmarked to see if…
devgioele
  • 129
  • 2
  • 10
-2
votes
1 answer

Go selection sort slower than bubble sort?

I was doing some coding to practice algorithms, and I found something weird, when I implement the simple sorters in Python, with a random input of 99 elements, selection sort is faster than bubble sort: This is my bubble and insert sort…
cprieto
  • 400
  • 2
  • 14
-3
votes
1 answer

PHP benchmarking: fastest way to parse a $date_string

I have $date_string = '12/1/2014'; I need: To parse it into a timestamp number (to save in a DB) And then parse that timestamp to output in a different format, e.g. December 1, 2014 I am assuming that using the DateTime class would be the…
Geo
  • 12,666
  • 4
  • 40
  • 55
-6
votes
1 answer

What is more efficient for a PHP variable, $timelimit 10*60; or $limit 600;?

What is more efficient for a PHP variable, $timelimit = 10*60; //10 minutes or $timelimit = 600; //10 minutes? I feel as though $timelimit = 600; //10 minutes would be more efficient/optimized since I am telling PHP that the $timelimit is 600, and I…
PRAWKC
  • 7
  • 2
1 2 3
32
33