From 68dca986ee7ff7d729a15565e2e07127d5b5d1a4 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Wed, 30 Sep 2026 13:52:30 +0100 Subject: Say that prefetching items did not pay, and why (109) Fetching a found item's cells, a leaf's keys and each level's keys ahead made finding and reading items 20% faster on 100,000 items in a micro benchmark, but TPC-C's clean pairs moved 1% at most and finding alone got 48% slower, so it is not in. The owner's finding samples were the descent, not the fields: a write right after a read copies the leaf whole anyway, and what costs is walking structures larger than the caches at random. --- research/experiments/024-finding-items/runs.sh | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 research/experiments/024-finding-items/runs.sh (limited to 'research/experiments/024-finding-items/runs.sh') diff --git a/research/experiments/024-finding-items/runs.sh b/research/experiments/024-finding-items/runs.sh new file mode 100644 index 0000000..ddb740a --- /dev/null +++ b/research/experiments/024-finding-items/runs.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# The runs of docs/research/109, from the repository's root: the list +# micro-benchmark before and after prefetch.patch, then TPC-C's pure-serve +# before and after in turns (the tree is patched to build it, then put back). +set -e +out=research/experiments/024-finding-items +work=$(mktemp -d) +rest="core/module.c core/module-save.c core/module-text.c core/module-store.c core/flow.c store/store-tree.c store/store-log.c" +cp core/module-list.c $work/module-list-before.c +cp core/module-list.c $work/module-list-after.c +patch -s $work/module-list-after.c $out/prefetch.patch +for version in before after; do + cc -O2 -g -std=c17 -D_GNU_SOURCE -Icore -Istore $out/bench-seek.c $work/module-list-$version.c $rest -pthread -lm \ + -o $work/bench-$version +done +python3 $out/micro.py $work > $out/2026-09-30-micro-linux-aarch64.txt + +make -s build/pure-serve +cp build/pure-serve $work/pure-serve-before +cp $work/module-list-after.c core/module-list.c +make -s build/pure-serve +cp build/pure-serve $work/pure-serve-after +cp $work/module-list-before.c core/module-list.c +make -s build/pure-serve +for round in 1 2 3 4 5 6; do + first=before second=after + if [ $((round % 2)) = 0 ]; then first=after second=before; fi + for version in $first $second; do + python3 benchmarks/tpcc/run.py --serve $work/pure-serve-$version --warehouses 1 --check 0 --terminals 64 \ + --sqlite-threads '' --sqlite-group '' --seconds 20 > $out/2026-09-30-tpcc-$version-$round-linux-aarch64.jsonl + done +done -- cgit v1.2.3