stylewarning / quickutil

The solution to the Utility Library problem.
87 stars 8 forks source link

Alternative formula for calculating mid in range-product #20

Closed samebchase closed 11 years ago

samebchase commented 11 years ago

old: mid = (upper + lower)/2 new: mid = (upper - lower)/2 + lower

Rough benchmarks with time indicate this is twice as fast

stylewarning commented 11 years ago

@samebchase I tested with

(time (evenp (qtl:range-product 1 200000)))

on SBCL with no optimizations and full optimizations, with and without your patch, and I only got about 0.005 seconds difference.

stylewarning commented 11 years ago

Private discussions lead to the conclusion that the change did not speed things up. Closing.