Ask HN: A tool to analyse the orders of growth
Does anyone know of any code profiling tool that can do asymptotic analysis of source code?
For instance an algorithm with O(log n) multiplications and O(n^2) additions will be dominated by the multiplications for small n, and may mislead an analysis tool into believing the asymptotic time complexity of the algorithm to be O(log n), rather than O(n^2), since the additions will dominate for very large n, simply because at some point a n^2 > m log n, where m is the run time of addition and a is the run-time of addition.
This becomes even more difficult if addition and multiplication have non-constant run-time as well (e.g. multi-precision ints).