All articles
    mojo
    performance
    geospatial
    benchmarks
    runtime
    python
    gpu-acceleration
    cross-language
    architecture

    We Made a Python Hot Path 42× Faster With Mojo. We're Not Integrating It Yet.

    September 17, 2026redevops.io
    We Made a Python Hot Path 42× Faster With Mojo. We're Not Integrating It Yet.

    A seeded, end-to-end benchmark of a real pure-Python geometry engine ported to Mojo 1.1 (kernel, boundary, and end-to-end) and why a 42× microbenchmark still isn't a reason to add a fourth production language.

    Mojo 1.1 raised an obvious question for ReDevOps: should we use it to accelerate the Python implementation of the Runtime?

    Our initial code audit suggested no. Most of the Runtime is orchestration, context selection, governance, network/database I/O and LLM calls. The compute-heavy pieces already run in native libraries such as DuckDB, NumPy/BLAS, Torch and FAISS, or move to GPU implementations such as cuVS and cuDF after measured crossover points. Rewriting Python Runtime → Mojo Runtime would add substantial engineering work without necessarily changing end-to-end latency.

    But we found one unusually good Mojo candidate: our pure-Python geospatial engine. It contains real CPU-bound geometry: point-in-polygon, polygon intersection and O(n²) spatial joins. It is also determinism-sensitive, with boundary decisions turning on 1e-9 and 1e-12 epsilons. So we ported it to Mojo 1.1 and built a seeded, end-to-end benchmark, including adversarial epsilon cases and a Shapely reality check.

    Mojo won the kernel benchmark

    First, correctness: 0 mismatches. Mojo reproduced the Python implementation's general and adversarial boundary decisions exactly: the non-negotiable precondition, since these values feed content-addressed identity downstream.

    Then, speed: native Mojo kernels were 5.7×–42× faster than pure Python.

    If we had stopped there, integrating Mojo would have looked obvious. We didn't.

    Integration changed the result

    The Runtime has to move data from Python into Mojo and return the result. Our experimental implementation currently uses a flat-text/subprocess boundary. For heavy computation that cost is amortized; for cheap operations, it can erase the entire kernel advantage.

    That is exactly what happened with point-in-polygon: despite the faster Mojo kernel, serialization/boundary cost grew the operation from roughly 7 ms to 195 ms, and Python won end to end.

    Point-in-polygon end to end: pure Python takes 7 ms; the faster Mojo kernel through the flat-text/subprocess boundary takes 195 ms, a 188 ms boundary tax that erases the kernel win.
    Scroll the diagram sideways to read itFull size

    Heavy geometry behaved differently. At 256 vertices, polygon intersection was about 8.9× faster end to end with Mojo. Spatial joins crossed over around 300 left objects × 100 right polygons: above that region, the O(n²) computation becomes expensive enough that Mojo pays for the boundary crossing. Shapely reinforced the same conclusion: faster on small point-in-polygon workloads, slower than Mojo on large joins.

    OperationNative kernelEnd-to-end (flat-text boundary)Verdict
    Point-in-polygon (cheap)faster7 ms → 195 msPython wins
    Polygon intersection · 256 verticesfaster8.9× MojoMojo wins
    Spatial join · O(n²)fasterwins above ~300 × 100Mojo wins at scale
    Correctness · all cases-0 mismatchesexact

    The useful question therefore is: which execution backend is appropriate for this operation, at this scale?

    Why we're not integrating Mojo yet

    The benchmark classification is CONDITIONAL.

    Most Runtime latency still isn't caused by interpreted Python. Existing native libraries already handle much of the local compute, and GPU acceleration handles larger workloads. More importantly, the current Python↔Mojo boundary is too expensive: the native results show real potential, but the integrated results say we should first replace the flat-text/subprocess interface with a binary or direct FFI boundary and measure the crossover again.

    There is also a maintenance cost. ReDevOps already runs Python, Go and Kotlin implementations with cross-language contracts held bit-identical by a conformance suite. Another production language has to earn its place through a measurable end-to-end improvement.

    So we are not rewriting the Runtime in Mojo.

    The architecture that makes more sense

    One Python control plane owning orchestration, contracts, planning and governance, dispatching each operation to the backend that wins at its scale: Python for glue, native libraries for local compute, Mojo for heavy custom CPU kernels when the crossover justifies it, and the GPU for large workloads.
    Scroll the diagram sideways to read itFull size
    Python Runtime
        │
        ├── orchestration / contracts / planning / governance
        │
        └── execution selection
              ├── Python
              ├── DuckDB / NumPy / Torch / FAISS
              ├── Mojo — heavy custom CPU kernels, if crossover justifies it
              └── GPU — cuVS / cuDF
    

    That is already how we approach GPU acceleration: measure where an alternative execution backend becomes worthwhile, and dispatch accordingly. Mojo may eventually occupy the same role for custom CPU kernels.

    The benchmark showed that it can make one of our real pure-Python hot paths up to 42× faster while preserving deterministic behavior exactly. It also showed why that number alone is not enough.

    Optimize the execution path over the language label.

    Want ReDevOps in your Google Top Stories & AI results?Follow ReDevOps on Google