Skip to the page

Benchmarks

Measured, side by side

A number on its own says little, so every one here stands next to the same thing done another way: the same programs in Hematite, Ruby and Python, and the same web app in Kiln, Rails and Django. Each comes with the CPU and memory it took.

01

The language

Seven small programs, each leaning on one part of the language, written the same way in all three: the same steps and loops, no tricks in any of them. Before anything is timed, every version must print exactly what the Hematite one prints.

Hematite came out 1.9 to 78 times as fast. Its lead is largest where the work is the language itself (arithmetic, calls), and smallest where it's mostly memory being handed out (hashes and text).

Time for the whole program, startup included

loopInt arithmetic and variables

Hematite
3.5 ms
Ruby
63.7 ms
Python
274 ms

18.2 times as fast as Ruby, 78.4 times as fast as Python

floatsFloat arithmetic, and calls with named arguments

Hematite
2.8 ms
Ruby
103 ms
Python
101 ms

36.7 times as fast as Ruby, 36.0 times as fast as Python

fibmethod calls and recursion

Hematite
4.1 ms
Ruby
72.8 ms
Python
71.5 ms

17.8 times as fast as Ruby, 17.4 times as fast as Python

arrayspush, map, filter and each

Hematite
16.1 ms
Ruby
110 ms
Python
174 ms

6.8 times as fast as Ruby, 10.8 times as fast as Python

hashesget and set over 1,000 keys

Hematite
32.2 ms
Ruby
76.3 ms
Python
66.8 ms

2.4 times as fast as Ruby, 2.1 times as fast as Python

objectschanging methods on objects in an array

Hematite
19.0 ms
Ruby
102 ms
Python
162 ms

5.4 times as fast as Ruby, 8.5 times as fast as Python

stringsbuilding, joining and splitting text

Hematite
24.7 ms
Ruby
79.5 ms
Python
47.7 ms

3.2 times as fast as Ruby, 1.9 times as fast as Python

Peak memory and CPU time

ProgramMemory (MB)CPU (ms)
HematiteRubyPythonHematiteRubyPython
loop13.415.412.93.362.4264
floats13.215.413.22.798.998.7
fib14.015.413.74.270.570.4
arrays24.534.580.616.1109174
hashes13.015.413.531.775.266.7
objects13.415.413.418.699.8163
strings31.737.739.724.577.946.8

Memory is much the same for all three, since most of it is the program starting up; where a program keeps a lot (arrays), Hematite keeps it smaller. CPU time follows the time: none of these programs waits for anything.

02

The web framework

A framework is measured best on a whole application, with real amounts of data: a store, both the shop its customers see and the back office its staff run it from, over millions of orders. It's built in Kiln, Rails and Django, and one set of checks proves all three show the same pages, word for word.

The store: Selvage, pages answered a second

The same shop three times, over the same 890 MB database: 4,308 products in 65,368 sizes and colours, 310,200 customers and 2,478,696 orders. A guest with a bag asks for the shop's pages, and a member of staff for the back office, 64 at a time.

/The front page: the week's best sellers, a photo for each category

Kiln
393
Rails
326
Django
278

Typical wait 163 ms, 190 ms, 230 ms; slowest 1% 196 ms, 518 ms, 270 ms

/womenA department of 2,000 pieces, counted by size, colour and material, one page of 24

Kiln
415
Rails
286
Django
209

Typical wait 154 ms, 207 ms, 308 ms; slowest 1% 180 ms, 553 ms, 364 ms

/p/...A product: its colours and sizes, reviews and their chart, four that go with it

Kiln
2,075
Rails
1,051
Django
733

Typical wait 31 ms, 51 ms, 87 ms; slowest 1% 36 ms, 196 ms, 104 ms

/search/suggestSuggestions as you type, a piece of a page

Kiln
4,021
Rails
2,322
Django
2,262

Typical wait 16 ms, 22 ms, 28 ms; slowest 1% 19 ms, 102 ms, 33 ms

/officeThe back office's dashboard: today, the month by day, low stock

Kiln
370
Rails
303
Django
353

Typical wait 174 ms, 195 ms, 182 ms; slowest 1% 202 ms, 588 ms, 210 ms

POST .../reviewsA review written and kept: a write, waiting its turn for SQLite

Kiln
496
Rails
298
Django
314

Typical wait 126 ms, 160 ms, 152 ms; slowest 1% 212 ms, 893 ms, 1,176 ms

CPU for each page, and memory

PageKilnRailsDjango
/45.3 ms54.1 ms64.2 ms
/women43.1 ms61.9 ms84.8 ms
/p/...8.5 ms16.8 ms24.1 ms
/search/suggest4.4 ms7.5 ms7.8 ms
/office48.3 ms58.4 ms50.7 ms
POST .../reviews0.8 ms4.0 ms2.4 ms
Memory, all told197 MB2,579 MB967 MB

Kiln answered 1.2 to 2.0 times as many pages as Rails, and 1.0 to 2.8 times as many as Django, with less CPU for every one, in a thirteenth of Rails' memory and a fifth of Django's.

The heavy pages are mostly SQLite: on a department's list, 80% of Kiln's time is in it, running the same queries the others run. The framework is what's left, so the lighter the page, the more it shows: a product's page takes Kiln half of Rails' CPU, and a third of Django's.

A review is a write, and SQLite writes one at a time, so all three mostly wait for it. Kiln's slowest writes waited a fifth of a second; Rails' nearly a second, and Django's over one, as their processes take turns at the lock.

Every version uses the same SQLite settings, with every commit synced. Kiln keeps its sessions in memory, so a restart signs everyone out; Rails and Django keep theirs in signed cookies, checked on every request.

03

How it's measured

The programs run on an AMD Ryzen AI 9 HX 370, each on the same one of its fast cores (its cores aren't all alike): Hematite built into one executable (hem build) against Ruby 4.0.7 and Python 3.14.10, timed with hyperfine over 20 runs, with memory and CPU as the median of 9.

The store runs on the same machine, with 18 of its cores for the server and 6 for the load. Each page gets 64 connections for 15 seconds, after 3 seconds of warming up. Kiln is built into one executable; Rails 8.1 runs with YJIT on Puma, and Django 6.1 on Gunicorn, each with a worker per core and Kiln's SQLite settings, logging as they would in production.

Numbers move a few percent from run to run. Every benchmark, and the script that runs it, is in the repository, under benchmarks/.