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
0
votes
3 answers

Inconsistent results trying to microbenchmark

I have been trying to take some microbenchmarks of Lua code, but have run into an incredibly annoying problem: I can't seem to get consistent results. Example: here's a dead simple Lua program that's supposed to time a naive Fibonacci…
Alex Celeste
  • 12,824
  • 10
  • 46
  • 89
0
votes
2 answers

operating on pairs of elements in a data frame

I have two data frames, x and weights, in which columns are paired. Here are example data frames: x = read.table(text = " yr1 yr2 yr3 yr4 10 15 6 8 10 20 30 NA NA 5 2 3 100 100 NA NA", sep = "", header =…
Mark Miller
  • 12,483
  • 23
  • 78
  • 132
0
votes
3 answers

Why do different tests have exactly the same number?

Why is buffered 0.030000 seconds the same as "better" buffered 0.030000 seconds ? If 4 times larger linesize won't change time, how can I speed it up even more? Test $ ./a.out Unbuffered: 0.770000 seconds Buffered: 0.030000 seconds Better buffered:…
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
0
votes
1 answer

Why the performance discrepancy in try/catch vs. other forms of control flow in Java?

Possible Duplicate: How slow are Java exceptions? The following two programs take approximately the same amount of time to run: public class Break { public static void main(String[] argv){ long r = 0, s = 0, t = 0; for(long x…
0
votes
1 answer

Does object instantiation time depend on its size?

We know that object size depends on its field type. But does object instantiation time depend on its fields type? See my test public class Test { byte f1; byte f2; byte f3; byte f4; byte f5; byte f6; byte f7; byte…
Evgeniy Dorofeev
  • 133,369
  • 30
  • 199
  • 275
0
votes
1 answer

Better way to do simple performance testing

When comparing the performance of operations this is how I would typicaly do the tests:
UnkwnTech
  • 88,102
  • 65
  • 184
  • 229
0
votes
1 answer

Caliper @Param not working

I am trying to use the @Param annotation on a field with the command line args of the form: "-Dmyparamname=val1,val2,val3" and it is not working. I am using caliper-0.5-rc1.jar. My actual usage looks like: java -classpath "mylongclasspath"…
Kevin Welker
  • 7,719
  • 1
  • 40
  • 56
-1
votes
1 answer

Fast matrix operations in R

A couple of simple questions: I want to build a matrix X of the following type: N = 1000 A = seq(1, N, 1) B = A X = A %*% t(rep(1,N)) - rep(1,N) %*% t(B) Working with this matrix X is kind of slow: it takes a lot of memory for large N, and doing…
-1
votes
1 answer

Is this the fastest way to reformat a buffer of 64b values to 16b?

I have a datastream which outputs what are physically 64bit values to a buffer. When the buffer reaches a certain level, it needs to be reformatted to consecutive 16bit values. The real values are never more than 24 of the 64 bits of each value…
Douglas B
  • 585
  • 2
  • 13
-1
votes
1 answer

Does an integer smaller than 255 perform as fast as an unsigned character?

I know that an unsigned character's size is 8 bits, and the size of an integer is 32 bits. But I want to know if I perform an operation between two integers below 255, is it safe to say it is as fast as performing the same operation on two unsigned…
YoloWex
  • 139
  • 7
-1
votes
1 answer

Why do these two identical benchmarks have different results on the same browser but with two different platforms?

I want to understand why these two equal benchmarks have different results on these two different platforms. Classcat, clsx, obj-str, vanilla JS on perf.link Classcat, clsx, obj-str, vanilla JS on measurethat In the first one…
Fred Hors
  • 3,258
  • 3
  • 25
  • 71
-1
votes
1 answer

Plotting a datable with multiple columns (all 1:7 rows) via ggplot with a single geom_point() using aesthetics to color them differently

I intend to compare timings between two algorithm-based functions f1,f2 via microbenchmark which work on a rpois simulated dataset with sizes of: [1:7] vector given by 10^seq(1,4,by=0.5) i.e. : [1] 10.00000 31.62278 100.00000 316.22777 …
user11422223
-1
votes
1 answer

How can I understand these symbols in a C++ code?

Why the posix_memalign is written as ::posix_memalign? What is memory here? I am looking to benchmark the read and write speeds of my cache memories and RAM. For this purpose, I want to use google benchmark library and I saw an example code that…
aikhs
  • 949
  • 2
  • 8
  • 20
-1
votes
1 answer

How to improve this tcp socket communication?

I'm trying to implement a micro-benchmark for tcp socket communication though a loop of a send and receive messages. However, I've got a high latency compared to the standards latency of TCP socket in some diagrams. How can I improve my code…
Ines
  • 3
  • 1
  • 4
-1
votes
1 answer

How is this JMH microbenchmark skewed, if it is?

The benchmark is quite simple: @State(Scope.Benchmark) public class MathPowVsRawMultiplyTest { private static final double VICTIM; static { VICTIM = new Random(System.currentTimeMillis()).nextDouble(); } double result; …
fge
  • 119,121
  • 33
  • 254
  • 329
1 2 3
32
33