Skip to content

Commit

Permalink
Updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
emeryberger committed Dec 11, 2024
1 parent 8b2c533 commit 08ed01b
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
## bigO

`bigO` automatically measures empirical computational complexity (in both time and space) of functions.
To use `bigO`, you just need to decorate your function with a "length" function (the "n"),
and then run your function as usual, ideally along a wide range of inputs.
As long as your function calls another function, `bigO` will automatically generate diversity,
so you can get computational complexity information even when you aren't easily able to generate a wide range of inputs to the function.
`bigO` accumulates in a file `bigO_data.json` in the local directory; you can then generate a graph of time and space complexity for each tracked function.
To use `bigO`, you just need to add a `@bigO.track` decorator to your function together with a "length" function (the "n").
You can then run your function as usual, ideally along a wide range of inputs, and `bigO` will report the computational
complexity of that function.

A novel feature of `bigO` is that, as long as your function calls another function, `bigO` will automatically generate diversity.
This feature ensures that you can get computational complexity information even when there are not a wide range of inputs to the function (even one input is enough!).

`bigO` accumulates its results in a file named `bigO_data.json` in the local directory;
you can then generate a graph of time and space complexity for each tracked function by running `python3 -m bigO.graph`.

### Demonstration

Expand Down Expand Up @@ -45,3 +49,9 @@ python3 -m bigO.graph
This command creates the file `bigO.pdf` that contains graphs like this:

![bigO](https://github.com/user-attachments/assets/8428180b-a454-4fc7-822c-7a130f9ba54e)

### Technical Details

`bigO`'s curve-fitting based approach is inspired by ["Measuring Empirical Computational Complexity"](https://theory.stanford.edu/~aiken/publications/papers/fse07.pdf) by Goldsmith et al., FSE 2007.

To generate diversity even for fixed inputs, `bigO` uses a novel approach that randomly dilates both the execution time of called functions and memory allocations, in effect simulating the effect of different inputs.

0 comments on commit 08ed01b

Please # to comment.