#Examples
Four complete projects, each on a problem shaped like a real one and at a size where the design matters: tens or hundreds of millions of values over several dimensions. Get them from the Download page, signed in: one zip, elucid8-examples-<version>.zip, with a folder for each project (no data: each one generates its own). Each folder has:
- the program, in the language's notation v0.2;
- a seeded data generator;
- the configuration for the
elucid8command; - Python scripts that read the results the way an application would;
- a README with the time, memory and output size measured at full size;
- a
baseline/folder with the same computation written in the tool you might use instead (NumPy, DuckDB, Polars or pandas), checked against eLucid8's answers.
To run one, you need the elucid8 command of this release, from the Download page. You also need Python 3 with NumPy, or pyarrow and DuckDB for the features, or pyarrow for the markets. Each README starts with a quick run that takes seconds:
python3 generate.py --ticks 60
python3 analyse.py
#Point-in-time features for machine learning
Folder: examples/features/. Features and a churn label for 100,000 customers on every day of a year (36.5 million rows), computed from 2.2 million purchases.
- No feature can use its future: each purchase carries its hour's time as its timestamp, and each day's features take the purchases with timestamps up to midnight at the start of that day (
window). Each feature's timestamp shows it. - The label, "bought nothing in the next 30 days", is known only once those 30 days of data exist, and is eod (no data) until then.
- The script reads each column as an Apache Arrow file, puts them side by side into a Parquet training table, and runs two leakage checks that fail loudly: every sampled feature is recomputed from the raw purchases, and the table is rebuilt from only what was known on an earlier day and must agree.
- A late correction to one purchase, sent to
elucid8 serve, recomputes the 106 values that read it and reuses the rest.
Full size, on 18 threads: the table in 4.14 s (4.11 s written as records).
#A spatio-temporal sensor field
Folder: examples/sensor-field/. A grid of 256 × 256 temperature sensors over 1,000 ticks (65.5 million readings, 1.1 GB of CSV), with missing readings, an offline patch, faulty sensors, spikes and warm fronts.
- The program smooths the field, measures its trend, and gives each sensor and tick an alert.
- A missing reading is filled from the sensor's last one for up to 3 seconds, then it is eod. A faulty reading is an error that names the sensor in every alert it affects.
- A batch run reads the alerts as NumPy
.npzfiles, a frame per tick, and finds every injected fault and spike. - A stream replays the readings a tick at a time through
elucid8 serve, with the same alerts.
Full size, on 18 threads: the batch in 1.4 s, of which about 0.5 s is reading the 1.1 GB CSV. In the stream, a tick takes 2.2 ms to compute, and 10.5 ms from its readings being sent to its alerts in NumPy.
#A physical simulation
Folder: examples/simulation/. Heat spreading across a 512 × 512 plate for 1,000 steps, with heaters and cooling bars. It shows demand-driven evaluation concretely:
- A query for one probe cell at step 1,000 computes only its light cone: 217 million of the field's 262 million values (at step 100, 5% of them).
- A query for the whole plate computes it a level at a time with compiled kernels, as a NumPy
.npzfile that a short script renders as a PNG image. - The probe's answer equals the field's at that cell, to the last bit.
Full size, on 18 threads: the probe at step 1,000 in 0.29 s, the whole plate at step 1,000 in 0.35 s and 70 MB.
#Market feeds as of each moment
Folder: examples/markets/. A trading day of 4,001 symbols: 120 million quotes and 30 million trades, on separate feeds, each row with its own time. For every trade, the program gives:
- the quote in force when it happened (
asof); - how far the trade was from it;
- the volume-weighted price over the five minutes before it (
window); - whether the quote was stale.
Every answer carries a timestamp, the newest data it read, so its freshness comes with it. A variant with a planted leak (a window reaching one second past each trade) gives answers stamped after their trade, which one check over the timestamps finds. Two corrections to the quotes are sent to elucid8 serve.
Full size, on 18 threads: every trade's answers in 6.0 s, as one Parquet table that the Python script writes while elucid8 computes.
#Against the tools you might use instead
Each example has a baseline/ folder. It holds the same computation, on the same generated data, written as a user of each tool would write it:
- NumPy for the simulation and the sensor field;
- DuckDB SQL or pandas for the features;
- DuckDB SQL, Polars or pandas for the markets (pandas was not measured in the latest round).
Each baseline is checked against eLucid8's answers. Its measure.py runs eLucid8 and the baseline at full size, one after the other, and records every time with the machine's load at that moment.
How eLucid8 runs in each comparison, and what is timed:
| comparison | eLucid8 | what is timed |
|---|---|---|
| simulation: the plate, a probe | elucid8 run, one process | the whole process: reading the CSV files, computing, writing the .npz file |
| sensor field: the batch | elucid8 run, one process writing 40 .npz files | the whole process, reading the 1.1 GB CSV included |
| sensor field: the stream | elucid8 serve, a long-running process: each tick's readings are sent as new rows over HTTP, then the tick's alerts are asked for, as Arrow | per tick, as a Python client sees it: sending the rows, the answer, and reading it into NumPy (the query alone is given too) |
| features: the table | elucid8 run, one process writing an Arrow file per column, or records | inside the Python script, from its start to the Parquet file |
| features: a late correction | elucid8 serve: the corrected file is sent as a new version, then the columns are asked for again | the queries after the correction, and before it |
| markets: every trade's answers | elucid8 run, one process writing records per chunk of symbols | inside the Python script, from its start to one Parquet table |
The baselines are timed the same way, from reading the same files to the same result.
Exact sums, and sums in any order. eLucid8's sum and mean are exact: the exact value, rounded once, whatever the order of the elements. NumPy, DuckDB, Polars and pandas add in their own order instead. approx_sum and approx_mean let eLucid8 do the same, so each example was measured both ways:
- exact sums, the programs as written, in the tables below;
- sums in any order (
approx_*), like for like with the other tools, in the notes under each table.
Two comparisons, both measured, because the tools use threads differently:
- One thread against one thread:
elucid8 --threads 1, DuckDB with one thread, Polars with one thread, and pyarrow (which reads the CSV files for NumPy and pandas, and writes pandas' Parquet) with one thread. NumPy and pandas compute on one thread anyway. - Each tool at its defaults:
elucid8, DuckDB, Polars and pyarrow with as many threads as the machine has (18 here).
| example | eLucid8, one thread | eLucid8, 18 threads | baseline | one thread against one thread | each at its defaults |
|---|---|---|---|---|---|
| simulation: the whole plate at step 1,000 | 1.78 s | 0.35 s | NumPy 1.32 s | NumPy 1.35× faster | eLucid8 3.8× faster |
| simulation: one probe cell at step 1,000 | 1.50 s | 0.29 s | NumPy 1.32 s (the whole plate) | NumPy 1.14× faster | eLucid8 4.6× faster |
| simulation: one probe cell at step 100 | 0.042 s | 0.017 s | NumPy 0.27 s (the whole plate) | eLucid8 6.4× faster | eLucid8 16× faster |
| sensor field: the batch, 1,000 ticks | 7.19 s | 1.42 s | NumPy 7.19 s on one thread, 4.46 s on 18 threads | level | eLucid8 3.1× faster |
| sensor field: the stream, one tick | 13.2 ms | 10.5 ms | NumPy 6.9 ms on one thread, 5.8 ms on 18 threads | NumPy 1.9× faster | NumPy 1.8× faster |
| features: the training table to Parquet | 8.46 s | 4.14 s | DuckDB 21.6 s on one thread, 4.22 s on 18 threads; pandas 15.1 s on one thread, 14.5 s with pyarrow on 18 threads | eLucid8 2.6× faster than DuckDB, 1.8× faster than pandas | level with DuckDB; eLucid8 3.5× faster than pandas |
| features: the same table, written as records | 7.64 s | 4.11 s | the same | eLucid8 2.8× faster than DuckDB, 2.0× faster than pandas | eLucid8 1.03× faster than DuckDB, 3.5× faster than pandas |
| markets: every trade's answers to Parquet | 39.2 s | 6.00 s | DuckDB 78.4 s on one thread, 8.85 s on 18 threads; Polars 26.9 s, 10.0 s | eLucid8 2.0× faster than DuckDB; Polars 1.5× faster | eLucid8 1.5× faster than DuckDB, 1.7× faster than Polars |
pandas was not measured on the markets in this round: at this size it needs about 40 GB of memory. Its script is in the example's baseline/ folder.
With sums in any order (approx_sum, approx_mean):
- simulation, the plate: 1.23 s on one thread and 0.26 s on 18 threads: eLucid8 is 1.07× faster than NumPy on one thread and 5.1× faster at the defaults. Its 3 × 3 means are where exact sums cost most: a third more time at the defaults, and almost half more on one thread.
- sensor field: within 3% of exact sums.
- features: the same time. Its sums are of whole cents, which exact and approximate sums add alike.
- markets: 12% slower than exact sums on 18 threads (6.72 s) and 15% slower on one (45.1 s). Its sums are of whole price ticks, which the exact path adds as fast as any; the lanes
approx_sumkeeps beside them cost time here.
What each line compares:
- Simulation, the whole plate: the same computation. NumPy steps the plate with nine shifted array additions; eLucid8 computes it a step at a time in compiled loops.
- With sums in any order, every one of the 262,144 cells is NumPy's number to the last bit.
- With exact sums, every cell is within 10 units in the last place of NumPy's: NumPy's means are rounded more than once.
- Simulation, a probe: eLucid8 computes only the probe's light cone, the values that cell depends on; NumPy has no way to compute one cell other than computing the whole plate.
- At step 100 the cone is 5% of the field, and eLucid8 answers in 0.017 s, most of it starting the process and reading the two CSV files.
- At step 1,000 the cone is 83% of this plate, and on one thread NumPy's whole plate is faster than eLucid8 with exact sums.
- Sensor field, the batch: the alerts are the same: at full size every cell of all 1,000 ticks is compared (its value, eod, or an error naming the same faulty reading).
- With exact sums, 45 cells of 65.5 million differ, each where a score or a trend lies within a few units in the last place of its threshold, so the exact count of front cells is 252,109 against NumPy's 252,116.
- Reading the 1.1 GB CSV takes
elucid8about 0.46 s on 18 threads and 4.1 s on one (it also computes the file's version, a checksum of its bytes); pyarrow takes 4.9 s on one thread. - Computing the 65.5 million alerts takes eLucid8 about 0.87 s on 18 threads, against NumPy's 2.0 s.
- Memory: NumPy holds the whole history (8.3 GB);
elucid8holds the readings and a block of alerts (2.5 GB).
- Sensor field, the stream: what each does when a tick's readings arrive. NumPy parses that tick's lines and computes, in one process. With eLucid8, the Python client sends the tick's rows to
elucid8 serve, asks for the tick's alerts, and reads the reply into NumPy.- The query itself takes 2.2 ms on 18 threads (4.8 ms on one); the rest of the 10.5 ms is sending and reading.
- The client asks for each answer as Arrow, over HTTP. Asked over standard input with the answer as JSON, as the example did before, a tick takes 14.0 ms (16.7 ms on one thread): NumPy is 2.4× faster, at the defaults and on one thread. The query is the same either way.
- The counts of every tick are the same.
- Features, the table: the 30.6 million training rows are the same, row for row. DuckDB writes the whole table and the training rows to Parquet; with eLucid8,
elucid8writes each column as an Arrow file and the script puts them side by side and writes the training rows. Both times are inside Python, from start to the Parquet file.- Peak memory:
elucid80.7 GB; DuckDB 6.2 GB; pandas 12 GB.
- Peak memory:
- Features, as records:
build_table.py --recordshaselucid8write the five columns side by side, one record per (customer, day): the same 30.6 million training rows, with the coordinates written once per record instead of once per column. - Markets: the four answers and their four freshness columns are the same for all 30,049,305 trades in every tool.
- eLucid8's freshness is its timestamps; the other tools compute it by hand.
- eLucid8 reads the feeds in 1.3 s and computes and writes its records in about 4.0 s, chunk by chunk; the Python script reads each chunk as it appears and writes it into one Parquet table while
elucid8computes the next. - Peak memory: eLucid8 7.1 GB; DuckDB 18.6 GB; Polars 27.0 GB.
A late correction is not a race between the same computations, so it is not in the table.
- eLucid8: after one purchase's amount is corrected,
elucid8 servewith a point cache recomputes the 106 values that read that purchase and reuses everything else: 0.24 s for the five columns of 250 customers (the queries took 0.84 s before the correction). It knows what to recompute because it recorded what each value read. - DuckDB: a pipeline recomputes the whole table (4.0 s on 18 threads, 22.7 s on one). A user who knows that each customer's features read only that customer's purchases can recompute that customer's rows by hand (0.06 s, and 0.43 s to rewrite the table's Parquet file).
- The default service: this example's service turns off loops over boxes (
"boxKernels": false), because values computed in those loops are not cached. With the default, the service recomputes all five queries after the correction instead, in 0.04 s for 250 customers, faster than reusing.
In the markets, a correction to 0.1% of the quotes, chosen at random, touches 3,999 of the 4,001 symbols, so every tool recomputes nearly everything. A bad feed on 5 symbols for 10 minutes is where patching pays for the other tools, and where elucid8 serve, which recomputes only what a changed quote can change, answers again in 0.6 s: the Markets README gives both.
A small neural network against PyTorch. Not one of the four projects, but measured the same way: a network of 89 parameters (one hidden layer of 8 tanh units, on 9,212 samples of the Alps temperatures), trained with gradients written by hand, against the same network in PyTorch 2.14 on the CPU, in 64-bit floats. Per training step:
| eLucid8, exact sums | eLucid8, sums in any order | PyTorch (gradients by hand; autograd) | |
|---|---|---|---|
| each at its defaults (eLucid8 18 threads, PyTorch 6) | 0.45 ms | 0.38 ms | 0.27 ms; 0.29 ms |
| one thread | 2.35 ms | 1.48 ms | 0.46 ms; 0.47 ms |
PyTorch is 1.7× faster than eLucid8 with exact sums and 1.4× faster with sums in any order at the defaults, and 5.1× and 3.2× faster on one thread. eLucid8's loss equals an independent plain-loop computation of the same training bit for bit at 60, 200 and 1,000 steps; PyTorch's is within 6e-13 of it. With exact sums, the largest part of eLucid8's time on one thread is the exact small sums of products in each unit; with sums in any order, tanh and the gradients' long sums. eLucid8 has no GPU backend and no automatic differentiation yet.
Where eLucid8 is slower:
- the markets on one thread, where Polars is 1.5× faster;
- a stream's round trip through
elucid8 servein a Python client; - the small neural network against PyTorch, especially on one thread with exact sums;
- on one thread, computing whole fields that NumPy computes with array operations: the simulation's plate with exact sums (the sensor field's alerts are now level).
Measured with release 0.22.0 of elucid8, running each example's program as released with it (the simulation's whole plate, the stream and the corrections with release 0.24.0, on 6 November 2026), on an Apple M5 Max (18 cores, 64 GB), macOS 26.6.2. The other tools were measured on the same machine the day before, with Python 3.12, NumPy 2.5.3, DuckDB 1.5.6, Polars 2.0.0, pandas 3.0.6, pyarrow 26.0.0 and PyTorch 2.14.
- Each time is the best of 3 runs (the network's, of 5), each a fresh process.
- Before each run the machine's 1-minute load average was below 3, with nothing else running.
- The versions matter: DuckDB 1.5.6 builds the feature table faster than DuckDB 1.4.5 did, and pandas 3.0.6 more slowly than pandas 2.3.3.
Against the numbers published before (measured with elucid8 0.22.0, on the same machine and versions), the rows measured again with 0.24.0:
| 0.22.0 | 0.24.0 | ||
|---|---|---|---|
| simulation: the whole plate at step 1,000 | 0.36 s; 1.81 s on one thread | 0.35 s; 1.78 s on one thread | faster |
| sensor field: the stream's tick, answers as Arrow over HTTP | 12.5 ms; 14.8 ms on one thread | 10.5 ms; 13.2 ms on one thread | faster |
| sensor field: the stream's tick, answers as JSON over standard input | 16.6 ms; 18.6 ms on one thread | 14.0 ms; 16.7 ms on one thread | faster |
| sensor field: the stream's query | 3.4 ms; 5.7 ms on one thread | 2.2 ms; 4.8 ms on one thread | faster |
| markets: the service after a correction, 0.1% of the quotes at random; the bad feed | 7.3 s; 5.1 s | 3.0 s; 0.6 s | faster |
| features: the correction with a point cache, five columns after it | 0.25 s | 0.24 s | level |
| features: the same five columns before the correction | 0.79 s | 0.84 s | 6% slower |
| features: the correction with compiled loops, after it | 0.06 s | 0.04 s | faster |
The other numbers on this page were measured with 0.24.0 too, and were within 5% of 0.23.0's or faster; they keep 0.22.0's figures.
To measure on your machine, in an example's folder after python3 generate.py, run python3 baseline/measure.py, with NumPy, or pyarrow, DuckDB, Polars and pandas installed. It takes a few minutes for each example, and about 80 minutes for the markets. Each README gives the details.