python-scaling-regression-tests
Skill0 starsChanged 39 days agoMITView on GitHub
Use when Python code remains fast on small fixtures but slows disproportionately with input size, or a refactor may turn a linear algorithm quadratic; applies to empirical complexity regression tests, size-function design, and bigO measurement isolation.
In this repository66 other files it gives its agents.
- AGENTS.mdAGENTS.md
- postgres-locking-joinsSkill
- ai-bug-patternsSkill
- compressed-ndjson-boundariesSkill
- http-resume-integritySkill
- linux-io-latency-triageSkill
- macos-disk-space-recoverySkill
- minimal-sufficient-evidenceSkill
- modularize-large-filesSkill
- patch-reproducer-validitySkill
- prompt-cache-boundariesSkill
- proton-drive-selective-backupSkill
- transactional-outbox-deliverySkill
- conventional-commitsSkill
- git-advanced-mergingSkill
- git-bisect-forensicsSkill
- git-data-recoverySkill
- git-hooksSkill
- git-rerereSkill
- git-reset-mechanicsSkill
- git-revisions-syntaxSkill
- git-rewriting-historySkill
- git-submodulesSkill
- git-worktreesSkill
- github-ssh-keysSkill
- npm-publish-ci-pitfallsSkill
- sapling-stacked-pr-workflowSkill
- go-concurrency-patternsSkill
- go-data-idiomsSkill
- go-error-handlingSkill
- go-interfaces-embeddingSkill
- go-pprof-profilingSkill
- marketing-funnel-diagnosisSkill
- marketing-geo-experimentsSkill
- marketing-incrementalitySkill
- marketing-positioning-testsSkill
- python-descriptors-mroSkill
- python-logging-cookbookSkill
- python-unicode-gotchasSkill
- rust-compile-time-invariantsSkill
- rust-deterministic-concurrency-testsSkill
- rust-error-identity-boundariesSkill
- rust-regex-search-contractsSkill
- rust-runtime-bug-classesSkill
- rust-tokio-actor-deliverySkill
- rust-tokio-cancellation-safetySkill
- sales-discovery-qualificationSkill
- sales-mutual-action-plansSkill
- sales-pipeline-forecast-calibrationSkill
- sales-value-negotiationSkill
- ai-triage-evaluationSkill
- container-image-patchingSkill
- dependency-artifact-integritySkill
- dnssec-sentinel-diagnosticsSkill
- iam-policy-change-replaySkill
- rbvm-applicabilitySkill
- rbvm-asset-evidenceSkill
- rbvm-guarded-remediationSkill
- rbvm-priority-decisionsSkill
- rbvm-risk-exceptionsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Test how cost grows, separately from how many milliseconds one execution takes.
- Very specific: line 21
Use a dedicated performance-test process.
- Distinctive: line 43
Before trusting the gate, temporarily substitute a behavior-equivalent quadratic implementation and confirm rejection.
- Distinctive: line 52
Do not fix flaky results by silently weakening the bound.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Scaling Regression Tests
Test how cost grows, separately from how many milliseconds one execution takes. A faster implementation can still have a worse growth curve. An empirical fit is evidence over sampled inputs, not an asymptotic proof.
Choose the experiment
| Decision | Constraint |
| Size function | Represent the work-driving dimension; use constant-time metadata such as len(a) + len(b), not a traversal |
| Input family | Exercise meaningful sizes and distributions; separate early-exit, worst-case, and duplicate-heavy cases |
| Timing boundary | Construct fixtures outside the measured function; include copying only when copying is part of its contract |
| Claim | Pair growth checks with output assertions; keep absolute-latency budgets separate |
Isolated bound check
Use a dedicated performance-test process. The upstream plasma-umass/bigO API checked on 2026-10-04 exposes assert_bounds and disable_persistence; verify the project's pinned dependency.
from bigO import assert_bounds, disable_persistence
disable_persistence() # Dedicated test process: suppress exit-time JSON writes.
def unique_count(values):
seen = set()
for value in values:
seen.add(value)
return len(seen)
def test_unique_count_scaling():
samples = [(list(range(n)),) for n in range(2_000, 82_000, 2_000)]
assert unique_count([2, 2, 5]) == 2
assert_bounds(unique_count, lambda values: len(values), samples,
time="O(n)")assert_bounds clears prior in-memory measurements. A short no_persistence() block restores the save flag afterward, so it does not prevent later exit-time writes. For exploratory track runs, use a fresh directory so accumulated bigO_data.json cannot mix experiments.
Before trusting the gate, temporarily substitute a behavior-equivalent quadratic implementation and confirm rejection. Repeat the unchanged baseline to check noise sensitivity; restore the real implementation afterward. Record the dependency version and input family with the result.
Sources: Python⇒Speed, 2026-01-07, upstream API and caveats, checked implementation.
Pitfalls
- One size or tiny inputs can hide a growth change beneath call overhead.
- A passing bound misses constant-factor slowdowns and untested input distributions.
- Concurrent calls are outside bigO's supported measurement model; isolate the benchmark.
- Do not fix flaky results by silently weakening the bound. Inspect samples, environment noise, and the chosen size metric first.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

