4 ms·
But at this point all you're saying is "I can't think of a way of testing performance".
by tome 9y ago
But at this point all you're saying is "I can't think of a way of testing performance".
- reacweb 9y agoPerformance can be tested in a unit test. You just need to measure the time needed to compute the function on a given set of numbers, then measure the time needed to compute 1.0f / sqrt(x) on the same set of numbers. The test succeed if your function is 10x faster. In future, the test may fail because sqrt has improved and this trick is no more needed.
- squeaky-clean 9y agoNo I'm saying a test for performance doesn't accurately describe the reasoning behind it without accompanying documentation. Speed is the entire purpose of this method, not the numerical accuracy.