Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Depends on the use and context, benchmarking can hint at the "truth", that it is faster to just divide: ultimately the benchmark would have to have the two implementations and run them thru all possible inputs to know for sure.

It may clearly state that memoization is slower, until you plop it into a benchmark that inlines division explicitly without using a given hardware accelerate.

division by a constant input can be solved faster still, so there can be optimizations on top of memoization that would beat raw division on most peocessors/runtime environments.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: