Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any tools that can determine perform code analysis for Big-O complexity?

I haven't seen anything out there, and I suspect the difficulty with defining "n" since for generally for analyzing a complex function there'd be more than just one or two variables for defining.

There are analysis tools for cyclomatic complexity but are there ones for time (and/or space) complexity? If so which ones, if not, why not? Is it infeasible? Impossible? Someone just hasn't gotten around to it?

Ideally there'd be something like overall complexity for the application (defining different possible "n"s) as well as for each method in the app

Edit: So it seems like an exact solution is impossible because of the Halting Problem however, is some kind of heuristic approximation possible? I realize that for practical purposes a good profiler will give much more useful information, but it seems like an interesting problem.

Also, how about one that calculates for a certain subset of programs?

like image 981
Davy8 Avatar asked Mar 11 '09 19:03

Davy8


People also ask

What is Big O complexity analysis?

Big O notation is used to describe the complexity of an algorithm when measuring its efficiency, which in this case means how well the algorithm scales with the size of the dataset.

How can we find complexity of code?

This is done by directly measuring the number of paths through the code. Say a program is a graph of all possible operations. Then, complexity measures the number of unique paths through that graph.


1 Answers

Unfortunately there is this problem called the Halting problem...

like image 109
f3lix Avatar answered Jan 02 '23 23:01

f3lix