Instead of the global variable, can we have `sparse_multiply` return `avg_time`?