A better way to time Jacket code

ArrayFire Benchmarks 1 Comment

Whether you are a new Jacket programmer or a GPU maestro, you are bound to speed-test Jacket at some point. There are many factors to keep in mind while benchmarking Jacket code - a simple tic-func()-toc won't do. For example, this is some typical benchmarking code:

With Jacket 1.7, this entire code chunk is now replaced by two lines:

With TIMEIT, you get a fast and easy way to bench functions. This function takes as its input a function handle, that could be a Jacket function you want to benchmark:

Or it could be a function of your own:

TIMEIT takes care of all the factors involved in benchmarking GPU code. No longer do you have to worry about warmup: TIMEIT does that before executing GPU functions. Also, it times each function for a sufficient number of iterations by default, so you needn't call timeit() in a loop.

The addition of this feature is bound to make timing Jacket functions much simpler.  With this feature, Jacket programmers can concentrate on optimizing code, rather than writing helper timing functions.