Benchmark
benchmarkMeasure code time complexity by running it at increasing input sizes and fitting the growth curve to estimate Big-O class.
Instructions
Empirically measure time complexity by running code at increasing input sizes.
Contract: the code must read an integer N from stdin (first line) and do work
sized by N. codecalc runs it at each size in sizes and fits the growth
curve to estimate Big-O (O(1), O(log n), O(n), O(n log n), O(n^2)...). 3
sizes (the accepted minimum) can only return noise-floor O(1) or
"inconclusive" — never a growth class, not even exponential; 4+ sizes are
needed to trust the curve fit, 5+ doubling sizes for a robust ratio
median — estimate_basis names which estimator decided.
Example python: 'import sys\nn=int(sys.stdin.readline()); s=0\nfor i in range(n): s+=i\nprint(s)'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Program that reads integer N from stdin's first line and does work sized by N | |
| sizes | No | Comma-separated input sizes to run at, e.g. '100,1000,10000,100000' (this default: 4 sizes 10x apart, decided via curve-fit). 3 is the accepted minimum but can only return noise-floor O(1) or an inconclusive estimate — never a growth class, not even exponential, which needs 2+ agreeing doubling ratios (so 4+ sizes) and cannot decide on one; 4+ sizes are needed to trust the curve fit; 5+ DOUBLING sizes (n,2n,4n,8n,16n) are needed for a robust ratio median | 100,1000,10000,100000 |
| timeout | No | Wall-clock seconds allowed per size before that run is killed | |
| language | No | Language `code` is written in; default 'python3' | python3 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||