MLB-StatsAPI icon indicating copy to clipboard operation
MLB-StatsAPI copied to clipboard

Split search input by word

Open ap-ack opened this issue 1 year ago • 2 comments

#138

ap-ack avatar Jun 28 '24 14:06 ap-ack

Are you able to provide some timing comparisons, to see how much performance is impacted by this change? With the way you did it, I'm guessing it's minimal.

toddrob99 avatar Aug 14 '24 20:08 toddrob99

I measured my code as consistently running 1-2 ms slower than yours, even for single-word search inputs where we couldn't attribute this difference to the algorithm change. So I tried replacing the all/any functions with for-else loops, which to my surprise measured 1-2 ms faster than the existing code, even for multi-word cases. So I pushed that optimization.

Findings attached and as noted, this measures only the search so negates the network call latency, which far outweighs the search anyway.

stats-lookup-analysis.xlsx

ap-ack avatar Aug 15 '24 04:08 ap-ack