Algorithmic Code Optimization

Your Python is
fast enough.
It isn't.

Two tools. One workflow. Optimize any Python function with an LLM-powered rewriter — then track it forever with an automated benchmark agent that blocks regressions before they ship.

pip install -r requirements.txt
Runs locally. Your code stays on your machine.
79×
Fastest optimization so far
±3%
Benchmark variance (precise mode)
O(n)
Target complexity class
Verified result — find_duplicates() · n = 10,000 items
Before · O(n²)
def find_duplicates(items):
    duplicates = {}

    for i, item in enumerate(items):
        for j, other in enumerate(
            items[i+1:]    Bottleneck: O(n) scan per iteration
        ):
            if item == other:
                if item not in duplicates:
                    duplicates[item] = []
                duplicates[item].append(
                    (i, j)
                )
    return duplicates
After · O(n)
import itertools

def find_duplicates(items):
    _combinations = itertools.combinations
    indices = {}

    for idx, item in enumerate(items):
        indices.setdefault(    O(1) hash insertion
            item, []
        ).append(idx)

    return {
        item: list(_combinations(idxs, 2))
        for item, idxs in indices.items()
        if len(idxs) > 1
    }
79×
faster on n = 10,000  ·  identical output on all test cases  ·  pure Python, zero new dependencies

Deterministic pipeline

Not a linter.
Not a profiler.

ACENLY extracts the function's AST, identifies the complexity class, orchestrates targeted algorithmic rewrites, then stress-tests each candidate in an isolated subprocess before it ever reaches you.

1

AST extraction & complexity inference

ACENLY parses the function into an Abstract Syntax Tree. Nested loops, linear scans, and repeated membership checks are flagged as complexity liabilities — not just slow code, but structurally inefficient patterns.

2

Algorithmic rewrite generation

The LLM drafts multiple alternative implementations targeting lower Big-O classes — O(n²) → O(n), list scans → hash lookups, quadratic loops → single-pass aggregations. Surface-level changes are explicitly rejected.

3

Sandbox benchmarking & differential verification

Each variant runs inside an isolated subprocess against your real inputs. Timing is measured per-call. Output is compared element-by-element against the original. Code is only returned if it is faster and produces identical results.


Optimization spectrum

Four tiers.
One pipeline.

ACENLY adapts the aggressiveness of its rewrite strategy based on the detected complexity class of the input function.

Safe
Balanced
Aggressive
Max
Under the hood
Pure AST-level adjustments: local variable caching, early-exit insertion, loop-invariant hoisting, and compiler-friendly structural flattening. No algorithmic structure is changed.
No structural change
Expected output
Identical memory footprint. Identical complexity class. Minor constant-factor reduction. Target: 1.5× – 3× speedup on cache-friendly inputs.
1.5× – 3× speedup
Under the hood
Algorithmic map conversions: linear list scans replaced with hash lookups, membership tests replaced with set operations, repeated key checks collapsed into dict.setdefault() or Counter patterns.
Complexity class change
Expected output
Drastic complexity reduction. O(n²) → O(n) is the standard outcome. Memory usage may increase slightly due to auxiliary hash structures. Verified safe for all tested inputs.
10× – 80× speedup
Under the hood
Full algorithmic swaps: sort-based deduplication, divide-and-conquer restructuring, generator-based lazy evaluation, or threading for embarrassingly parallel workloads. The original structure may not be preserved.
Full algorithmic rewrite
Expected output
Multi-threaded or sub-linear complexity. Significant speedup at scale. Output correctness is still verified — only passing candidates are surfaced.
Variable · verified correct
Under the hood
Complete autonomous rewrite. ACENLY drops the original implementation entirely and drafts an alternative from first principles — targeting the theoretically optimal algorithm for the inferred problem class.
Ground-up rewrite
Expected output
Built for extreme computational stress. The new implementation may use entirely different data structures. All variants are still benchmarked and differentially verified before delivery.
10× – 100× speedup

Benchmark Agent — Feature 2

Catch regressions
before they ship.

A second tool built into ACENLY. Track any function's performance across every commit. Block slow code at the git level. Visualize the full history in a dashboard.

±3%
run-to-run variance
<15s
precise benchmark time
0
regressions shipped
terminal — git push origin main
────────────────────────────────────── ACENLY Benchmark · main@a3f1c8b · precise ────────────────────────────────────── Function Median vs last ──────────────────────────────────────── process_batch 14.2 µs ~ +0.8% ✓ stable find_pairs 135.1 µs ~ +0.2% ✓ stable deduplicate 41.8 µs ▲ 31.2% slower ✗ BLOCKED ────────────────────────────────────── ✗ Push blocked — regression exceeds threshold deduplicate() was 31.9 µs → now 41.8 µs Commit: a3f1c8b · Branch: main ────────────────────────────────────── Run with --skip-hooks to override. Or: python3 main.py --file api.py --function deduplicate

Precise mode

Adaptive warmup + batch timing eliminates OS scheduler noise. Stable to ±3% even for 13 µs functions. Repeats N times and keeps the best result.

🔒

Git pre-push blocking

One command installs the hook. If any tracked function is more than 10% slower than the previous commit, the push is blocked — before CI, before review.

📈

Dashboard & history

Every run is stored. Open the dashboard to see the full performance timeline — which commit slowed things down, by how much, and what the trend looks like.

🔁

CI / GitHub Actions

Drop the included Action into any workflow. Benchmarks run on every push with no additional configuration beyond a list of functions.


Verified results

Two functions.
Two real runs.

These are the only two functions tested publicly so far. No cherry-picking.

find_duplicates(items)
79×
O(n²) → O(n)
Nested loop replaced with a single hash-grouping pass using setdefault and itertools.combinations. Output verified identical on all test cases.
deduplicate_preserve_order(items)
12×
O(n²) → O(n)
List membership scan in a loop replaced with dict.fromkeys(), which preserves insertion order natively in Python 3.7+.

Infrastructure

Your model.
Your machine.

ACENLY is not a hosted service. You run it. You choose the model. Your code goes nowhere you don't authorize.

Local

Ollama

Run any Ollama model. Nothing leaves your machine. No API key, no per-token cost, no data exposure.

Cloud

Any provider

OpenAI, Together AI, or any OpenAI-compatible endpoint. Point ACENLY at the model that fits your budget and quality requirements.

Visibility

Token tracking

Every run reports prompt and completion tokens consumed — so you know exactly what each optimization job cost before you pay the invoice.

Ollama OpenAI Together AI GPT-4o Llama 3 Qwen 2.5 GPT-OSS 120B Any OpenAI-compatible API


Pricing

Simple tiers.
No surprises.

Start free. Add the benchmark agent and regression blocking when your team needs it.

Basic
Free
Everything you need to optimize functions on your own machine.
  • LLM-powered optimizer
  • Local Ollama or cloud model
  • Precise benchmark mode
  • Local dashboard
  • Git hooks & regression blocking
  • CI / GitHub Actions
  • Shared team dashboard
Get started free
Enterprise
/ contact us
Full control. Run everything inside your own infrastructure.
  • Everything in Teams
  • Self-hosted deployment
  • Custom LLM endpoint
  • SSO / SAML
  • Audit log
  • Priority support & SLA
  • API access
Contact us

FAQ

Common questions.

Any pure Python function — data processing, search routines, deduplication, aggregation, graph traversal, string manipulation. If it has a measurable runtime and deterministic output, ACENLY can work with it. Functions that rely heavily on I/O, network calls, or side effects are less suited, since the bottleneck there is external rather than algorithmic.
Only if you choose a cloud model like OpenAI or Together AI — in which case your function is sent to that provider's API, the same as any other API call you make. If you run ACENLY with a local model via Ollama, your code never leaves your machine at all. You choose the model, you control the data flow.
Every candidate rewrite is tested against the original function before it reaches you. ACENLY runs both implementations on the same inputs and compares outputs directly — if they diverge in any case, that candidate is discarded. You only see code that has passed this differential verification. The benchmark result you receive is from a variant that has already proven it produces the same results as what you started with.
No. ACENLY outputs pure Python — standard library only, no compiled extensions, no new build steps, no environment changes. The goal is algorithmic improvement: the same problem solved with a better approach, not the same approach acenlyerated with a different runtime. The faster code you get back runs anywhere your original code ran.
Typically a few minutes from paste to result. The exact duration depends on the complexity of the function, the number of variants generated, and the speed of the model you're using. Local models are slower per call but have no latency overhead. Cloud models are faster per call but depend on your connection and the provider's load. Either way, you wait once — not every time you call the function.
It tells you. If no candidate passes the correctness check, or none of the verified candidates outperform the original on your actual inputs, ACENLY reports that explicitly. You won't receive a "faster" result that isn't — the benchmark numbers are real, and if none improve on the baseline, the run ends with that conclusion.

Contact

Get in touch.

Have a specific function you want to test, a question not covered above, or just want to talk? Send a message directly.

Message sent. I'll get back to you shortly.