Skip to content

Examples

Seeing is better than believing. The same code in two languages side by side, with the measured gain underneath. All numbers come from our benchmark reports, no estimates — and what stands here is exactly what was measured.

Example 1: arithmetic loop (summing 10 million numbers)

A classic arithmetic loop: the same algorithm, two languages. This shows what compilation to native C delivers without changing anything yourself.

Python

def loop_sum(n):
    total = 0
    for i in range(n):
        total += i
    return total

print(loop_sum(10_000_000))

NoodleCore

fn loop_sum(n: int) -> int {
    var total = 0
    var i = 0
    while i < n {
        total = total + i
        i = i + 1
    }
    return total
}

Measured result (iMac Pro, fastest of 3 runs; C side with -O3 -march=native)

Language Time Speedup
Python (CPython 3.11) 609.1 ms —
NoodleCore → C 17.2 ms 35.4× faster

How much you win grows with the share of pure computation. Our heaviest compute benchmark (arithmetic, 1 million iterations) measures 51,826 ms in Python against 17 ms native — 3,049×. That is a different test than the one above; all Python comparisons are listed together on the Language features page.

Example 2: the language's own tax (NC versus hand-written C)

The question behind every "fast language": how much does the language itself cost? For NoodleCore this is measured case by case against hand-written C, with the same compile flags (-O3 -march=native). Here is the string-append test: appending one character to a string, 100,000 times.

NoodleCore

fn append_100k() -> str {
    var s = "x"
    var i = 0
    while i < 100000 {
        s = s + "x"
        i = i + 1
    }
    return s
}

Hand-written C

#include <stdio.h>
#include <string.h>

int main(void) {
    char buf[100001];
    memset(buf, 'x', 100000);
    buf[100000] = 0;
    printf("%zu\n", strlen(buf));
    return 0;
}

Measured result (iMac Pro, fastest of 3 runs; C side with -O3 -march=native)

Language Time Ratio
Python (CPython 3.11) 8.4 ms —
Hand-written C 5.0 ms 1.7× faster than Python
NoodleCore → C 5.1 ms 1.6× faster than Python

Three languages, one test — and the core of the story: NC (5.1 ms) sits within 2% of hand-written C (5.0 ms), while Python needs 68% more time than C. The layer between Python and C disappears entirely; the tax being paid is Python's own.

Example 3: database (NoodleDB versus SQLite)

The third pillar: the database lives inside the language. The same question over the same data — 1 million order lines — A/B measured: Python with SQLite against NoodleCore with NoodleDB. Here is the first row of the table: the average amount per status group.

Python + SQLite

import sqlite3

con = sqlite3.connect("orderlines.db")
rows = con.execute(
    "SELECT status, AVG(bedrag) FROM orderlines"
    " GROUP BY status ORDER BY status"
).fetchall()

NoodleCore + NoodleDB

use noodledb_sql

fn main() -> int {
    db = ndb_open("orderlines.ndb")
    ndb_exec(db,
        "SELECT status, AVG(bedrag) FROM orderlines" +
        " GROUP BY status ORDER BY status")
    return 0
}

Measured (iMac Pro, 1 million rows, median of 5 runs — 20 October 2026)

Query SQLite NoodleDB Gain
Average per group (AVG + GROUP BY) 988.0 ms 545.4 ms 1.8× faster
Count in range (COUNT + WHERE) 126.9 ms 80.7 ms 1.6× faster
Count on customer range (COUNT + WHERE) 60.5 ms 57.6 ms 1.05× faster

Example 4: four databases, one measuring stick

Being compatible is one thing; being measurably fast is another. The same query, the same data, on the same machine - but now four engines side by side: NoodleDB, PostgreSQL 18, SQLite and DuckDB. One benchmark suite, median of 5 runs, correctness hard-checked per query.

No cherry-picking: one suite measures every class. And where NoodleDB does not win yet - bulk load via SQL strings, point lookups over the wire protocol - the table says so, with the improvement track below.

(iMac Pro, 100,000 rows (seed 42), median of 5 runs — the four-engine table on 10 November 2026, the wire-protocol table on 19 November 2026 (same machine, one engine build per day, all routes within one day measured in a single window; load 3.4-4.7 and ~4.1 respectively).)

Query NoodleDB PostgreSQL 18 SQLite DuckDB
Bulk load 100k rows (SQL strings) † 170 920 122 2563
Point lookup (PRIMARY KEY) 0.00 0.12 0.02 0.26
Range scan (WHERE BETWEEN) 0.26 6.93 12.18 2.07
2-table join 0.71 8.63 13.53 1.23
3-table join * 1.06 15.72 18.43 1.73
GROUP BY + COUNT + AVG 0.36 14.34 43.63 1.10
Text search LIKE 0.42 10.62 11.85 1.84
2-hop graph count (self-join) 1.02 42.49 75.82 6.10
Indexed text search 0.27 1.80 0.38 -
10k UPDATEs in 1 transaction 25.86 936.38 34.98 3837.82

The cost of the wire protocol

NoodleDB also speaks the PostgreSQL and MySQL wire protocols. Same engine, same data, but now over the network protocol, like a regular database client:

Query NoodleDB direct NDB via Postgres protocol NDB via MySQL protocol
Bulk load 100k rows 166 377 269
Point lookup (PRIMARY KEY) 0.00 0.17 0.23
Range scan (WHERE BETWEEN) 0.28 0.40 0.44
2-table join 0.72 0.96 0.97
3-table join * 1.22 3.30 1.27
GROUP BY + COUNT + AVG 0.43 0.99 0.59
Text search LIKE 0.49 0.81 0.85
2-hop graph count (self-join) 1.08 1.64 1.41
Indexed text search 0.27 - -
10k UPDATEs in 1 transaction 21.30 - -

* 3-table join: NoodleDB executes the nested form (two hash joins), the other engines the flat form - same result, same data. The flat 3-join is a known optimization track.

† Bulk load here via built SQL strings. On the batch-API form (executemany) NoodleDB narrowly beats SQLite: 104 versus 106 ms; via SQL strings SQLite is faster (122 versus 170 ms). That gap is proven client-side string-building cost, not an engine difference.

Where NoodleDB wins: 11 of the 12 comparable points, all four engines measured on the same day - range scans (7.9x vs DuckDB, 27x vs PostgreSQL, 47x vs SQLite), joins (1.6-1.7x vs DuckDB, 12-15x vs PostgreSQL, 17-19x vs SQLite), aggregates (3.1x vs DuckDB, 40x vs PostgreSQL), 2-hop graph counts (6.0x vs DuckDB, 42x vs PostgreSQL), text search (4.4x vs DuckDB), point lookups (5.4x vs SQLite) and 10k updates (1.35x vs SQLite). Bulk load via SQL strings is the single loss (0.84x vs SQLite) - proven client-side cost, because on the batch-API form NoodleDB wins (see †). Over the wire protocols, point lookups still trail SQLite's in-process call - that is the improvement track.

The wire-protocol table shows the same NoodleDB engine over the PostgreSQL and MySQL protocols, one measurement run on one engine build with the direct route alongside. Over the protocol the engine stays recognisable: range scans run within 0.16 ms of direct, 2-table joins within 0.25 ms, and the MySQL route keeps the 3-join within 0.06 ms of direct. What remains: point lookups pay the roundtrip (0.17-0.23 ms) and loading over the protocol is slower than the direct batch route - that is the improvement track.

Example 5: the heaviest join — self-join on 1 million rows

The self-join was the deepest gap of the entire campaign: 194.8× slower than SQLite. After the acceleration of 21 October 2026 the same query on the same machine runs in 42.12 ms — 3.3× faster than SQLite (139.58 ms), with an identical row count.

This is not an isolated measurement but the campaign's gate: all 16 heaviest query shapes were measured together after the fix in one coherent run - the gate run on 1 million rows, 10 November 2026 - and every single one is now faster than SQLite. Correctness strictly checked per query (rows 1/1 up to 632,117/632,117 exactly matching the oracle).

(iMac Pro, 1 million rows, median of 5 runs, 10 November 2026 - the coherent gate run of the full port)

Query NoodleDB SQLite NDB faster
Self-join on 1 million rows 42.12 139.58 3.3×
Heaviest aggregation (632,117 groups) 390 1167 3.0×
Full gate (16 query shapes) 16/16 faster — —

The three classes that still lost to DuckDB on the 100k benchmark (range scans, flat joins, GROUP BY) all turned into wins on 10 November 2026: 7.9×, 1.6-1.7× and 3.1× (see example 4).

Example 6: 22 questions over a gigabyte — TPC-H SF-1, measured honestly

The TPC-H question set is the standard stress test for analytical databases: 22 questions over roughly a gigabyte of order data (6,001,215 line items, scale factor 1). We run all 22, and all 22 are measured honestly: median of 5 runs, every answer checked against an independent oracle.

Honest measuring turned out to be the work itself. Four questions could not be measured honestly until November 2026: two returned an error and therefore looked fast (Q04, Q22), two never finished (Q13 cost 12 hours of CPU per attempt, Q21 exceeded the time limit). Those defects were fixed first; only then was anything measured. A failing query is not fast.

The heaviest question of the series — q21, a multi-way join over the order history — NoodleDB computes in 2.11 seconds. The full series is in the table.

Where we stand: on q01 and q06 NoodleDB is faster than DuckDB — the fastest database in this comparison — by 13% and 34% respectively. Against PostgreSQL 18 NoodleDB wins 14 of the 22 questions, against SQLite 17 of the 18 measured questions. On the remaining questions DuckDB is still faster; that is the open improvement path.

(iMac Pro, TPC-H-derived questions scale factor 1 (~1 GB), NoodleDB build adbc7eb5e measured on 1 December 2026 in a quiet measurement window (no parallel runs or builds); DuckDB, PostgreSQL 18 and SQLite on 30 October 2026, same machine, same data; all engines median of 5 runs, every answer checked against an independent oracle; not an official TPC benchmark.)

Question NoodleDB DuckDB PostgreSQL 18 SQLite
Q01 23.95 27.57 2,254.45 6,048.30
Q02 34.08 4.36 7.11 379.90
Q03 565.45 25.89 488.81 6,368.60
Q04 701.18 114.48 1,886.31 4,958.30
Q05 520.48 3.23 9.79 —
Q06 6.91 10.41 329.66 887.70
Q07 251.58 16.03 293.71 6,044.00
Q08 636.56 25.54 464.88 5,574.00
Q09 76.58 16.63 15.81 17.60
Q10 633.69 37.10 956.31 1,978.00
Q11 24.20 5.43 28.44 1,553.40
Q12 417.26 33.22 644.66 1,834.30
Q13 71.53 18.59 114.44 208.50
Q14 546.25 21.64 457.27 2,852.60
Q15 518.18 23.65 658.99 1,858.00
Q16 20.50 18.55 649.76 698.80
Q17 1,754.61 21.83 3,085.13 —
Q18 1,432.89 33.61 2,833.01 4,192.08
Q19 262.05 15.72 388.97 1,001.66
Q20 46.73 7.80 22.72 —
Q21 2,109.33 87.52 663.25 9,240.35
Q22 46.02 21.41 93.06 —

SQLite was absent for Q17/Q20/Q22 in the reference run: those cells show a dash, not a zero. Q05 (SQLite) exceeded the time limit and is as such not a measurement.

An honest caveat

The gain depends on the kind of work: the more pure computation and the heavier Python's interpreter tax, the bigger the win. Scripts that mostly wait on disk or network gain little. That is why we port the slow parts, not whole programs, and why we publish the method behind every claim.

Next step

Want your own slow piece of code measured? Mail michael@noodlecore.io: we translate, measure and send you the report. A place where you can type your own code comes later (phase 2 of the site); for now, you read along. More background: about the maker.