Asymptote is a VS Code extension designed to help competitive programmers visualize the theoretical speed of their code while typing. It combines a heuristic complexity analyzer with a robust local test runner. By providing a worst-case estimation instantly, it helps you catch accidental O(N²) or O(2^N) logic before you even compile.
Supported Languages: C++, Python and Java.
Quick Start
Via Command Line:
code --install-extension rayhuang2006.asymptote-helper
Via VS Code:
- Install Asymptote from the VS Code Marketplace.
- Open any
.cpp file.
- Start coding! The complexity CodeLens will automatically appear above your functions.
- Use the sidebar to import a problem and run local tests.
Features
1. Real-time Complexity Analysis (CodeLens)
See the Big O notation directly above your C++ functions. Asymptote parses your AST (Abstract Syntax Tree) to estimate time complexity dynamically.
- Algebraic Awareness: Understands that nested loops multiply (e.g.,
N * M).
- Confidence System: Marks analysis with
(?) if unknown functions or opaque external calls are detected.
- Toggleable: Use
Asymptote: Toggle Complexity Lens to show/hide the analysis instantly.

2. Local Judge (Runner)
A dedicated sidebar for managing test cases without leaving your editor—acting as a lightweight local judge built directly into VS Code.
- Problem Parsing: One-click import from Codeforces, AtCoder and NCU Online Judge. Fetches title, limits, statement, and sample cases.
- Local Execution: Compiles and runs your code against inputs.
- Verdict Display: Clear AC, WA, TLE, or RE status with execution time.
- Strict Comparison Mode: Option to enforce exact character-for-character matching for outputs, including trailing whitespaces.

3. Interactive Mode (Manual Judge)
Struggling with Interactive Problems (e.g., ? 1 -> 10)? You no longer need to write a custom interactor.
- Split-Column UI: Left side is You (The Judge), Right side is Your Code.
- Inline Input: Type your response directly in the log flow, just like a terminal.
- Automatic Piping: Asymptote handles the complex process piping for you.
Known Limitations
Asymptote's complexity analyzer uses static AST parsing and heuristics, providing estimations rather than formal mathematical proofs.
- Recursion & Master Theorem: Complex recursive trees or divide-and-conquer algorithms might not be fully resolvable.
- Dynamic Early Exits: While it detects
break and return, complex conditional early exits (like randomized algorithms) might overestimate the worst-case scenario.
- STL & Amortized Complexity: Currently, the analyzer might not perfectly differentiate the internal complexities of all C++ STL containers (e.g.,
std::map being O(log N) vs std::unordered_map being O(1)), and amortized operations like vector::push_back are estimated heuristically.
Requirements
To use the Local Judge feature, you need:
- C++ Compiler (GCC/G++): Must be installed and accessible in your system's PATH.
- Browser: Google Chrome, Microsoft Edge, or Brave, needed only for Codeforces, which answers a plain request with a browser check. AtCoder and NCU Online Judge are read over HTTP and need no browser.
Note: The Complexity Analysis (CodeLens) works entirely offline and out-of-the-box without any external dependencies.
Extension Settings
You can customize Asymptote via the Command Palette or VS Code Settings:
asymptote.enableCodeLens: Enable/disable the complexity analysis CodeLens (default: true).
asymptote.chromePath: Custom path to your browser executable (optional, if auto-detection fails).
asymptote.strictComparison: Require exact character match for test cases, including trailing spaces and newlines (default: false).
Future Roadmap
- Manual Tagging & Community Rules: UI to manually correct and annotate complexity for
(?) functions, establishing a solid foundational rule base before introducing AI.
- Smart Cache (The Nexus): Identify code structures via AST fingerprinting. Once a template is manually tagged, Asymptote remembers it globally.
- Local LLM Integration: After establishing the manual rule base, we plan to integrate local models to evaluate edge-case algorithms that fall outside static tree-sitter heuristics.
Release Notes & Changelog
This project uses an automated CI/CD pipeline. All version history, release notes, and updates are automatically generated and maintained in the CHANGELOG.md.
Contributing
Contributions are welcome! Asymptote follows a modern, automated development workflow. Here is the basic development setup:
- Clone the repository and install dependencies:
npm install
- Run the test suite to ensure the AST analyzer works:
npm test
- Press
F5 in VS Code to launch the Extension Development Host and debug locally.
Branching & Committing
- Create your feature branch (
git checkout -b feature/amazing-feature).
- Commit your changes following the Conventional Commits specification (e.g.,
feat: add awesome feature). This is required for our automated release system.
- Push to the branch and submit a Pull Request.
License
Distributed under the MIT License. See LICENSE for more information.