This is a useful function for benchmarking a single function or comparing the benchmarks of several functions. Usage:
// Let's say we have 3 functions called foo, bar, baz
// we pass them as references in an array and assign them an id that will be printed in log
::MSU.Utils.benchmark([
["Endy", foo],
["Midas", bar],
["Taro", baz]
]);
This will print to log the performance of the 3 functions as well as their relative performance to the first function i.e. in this case Endy.
In case your functions need parameters you can manually call them via passing lambdas to the utility function and using local variables as the args:
This is a useful function for benchmarking a single function or comparing the benchmarks of several functions. Usage:
This will print to log the performance of the 3 functions as well as their relative performance to the first function i.e. in this case
Endy
.In case your functions need parameters you can manually call them via passing lambdas to the utility function and using local variables as the args:
Sample: