1

I'm going to test the performance for some math function like pow, exp and log etc. Is there any reliable test data for that?

As those functions were highly optimized in exist modern system library like glibm or in OpenJDK, the general random inputs may lead to a quick convergence, or triggered some short path.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Tiger
  • 157
  • 2
  • 10
  • The fact that you have to ask suggests your maths and programming are probably not good enough to yield meaningful results? Why would you need to do this benchmarking? – Mike 'Pomax' Kamermans Mar 22 '21 at 03:14

1 Answers1

1

Call them in a loop to test throughput or latency, depending on whether the input to the next call depends on the output of the previous or not. Probably with data from a small to medium sized array of random values for the throughput test.

You want your compiler to produce an asm loop that does minimal work beyond the function call, so use appropriate techniques for whatever language and compiler you choose. (Idiomatic way of performance evaluation?)

You might disassemble or single-step through their execution to look for data-dependent branching to figure out which ranges of inputs might be faster or slower. (Or for open-source math libraries like glibc, the commented source could be good to look at.)

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847