New tool countfn measures algorithm complexity by counting operations, not time
A developer has released countfn, available on both PyPI and npm, which measures algorithmic complexity by counting operations such as reads, writes, and calls rather than relying on elapsed execution time. Unlike existing tools such as big-O and big-o-calculator, countfn can return an 'UNDETERMINED' result instead of forcing a potentially incorrect complexity classification. Because operation counts are deterministic and noise-free, the tool avoids the statistical uncertainty inherent in timing-based measurements. The library also guarantees cross-language parity, meaning the same algorithm with the same seed produces identical operation counts in both Python and JavaScript. When complexity cannot be confidently identified — such as when two classes are too close to distinguish — countfn explicitly refuses to name one rather than guessing.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in