language-bench

File processing › Go

File processing Go 1.26

go build. Kernel time 181 ms on the average machine, index 1.25× vs the fastest (1.20×–1.33×), 6.2 MB average memory, 7.1 MB peak. Cold first iteration 185 ms, whole process 187 ms.

How this number came about

  1. The task. Before each iteration a fresh ~49 MB CSV file (id,word,value; 1,900,000 lines, a Zipf-like word distribution) is written to tmpfs, so the timed part measures reading and aggregating from memory, not disk speed. It streams the file once and returns the number of lines, the sum of the values, the number of distinct words and the most frequent word with its count. Every iteration gets a new, never reused instance from the deterministic generator lbgen (written to tmpfs as a CSV file before each iteration). A separate check compares an order-sensitive hash of the complete result of 20 iterations with the generator's reference; this was the case in every session.
  2. The environment. A fresh GitHub-hosted VM per session runs the pinned Docker image golang@sha256:24a707af49702fa44f02785475d02fb752f6982d3e9c0afb7696e1f0204e7ce9 containing go version go1.26.10 linux/amd64. Hardware, kernel and glibc of every session are listed below.
  3. The source. Exactly this code (hash 6a99dd364a2f48e1, in git at the commit of each session) is the kernel: it only decodes the instance and solves it. It is built together with the language's one harness, which owns the clock, the loop and the output:
package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
)

func Setup(args []string) {}

func Decode(data []byte) any { return string(data) } // path of the file

func Solve(inst any) any {
	f, err := os.Open(inst.(string))
	if err != nil {
		panic(err)
	}
	defer f.Close()
	sc := bufio.NewScanner(f)
	sc.Buffer(make([]byte, 1<<16), 1<<20)
	freq := map[string]int64{}
	var lines, total int64
	for sc.Scan() {
		line := sc.Text()
		c1 := strings.IndexByte(line, ',')
		c2 := c1 + 1 + strings.IndexByte(line[c1+1:], ',')
		v, _ := strconv.ParseInt(line[c2+1:], 10, 64)
		total += v
		freq[line[c1+1:c2]]++
		lines++
	}
	top, topCount := "", int64(-1)
	for w, c := range freq {
		if c > topCount || (c == topCount && w < top) {
			top, topCount = w, c
		}
	}
	out := []int64{lines, total, int64(len(freq)), topCount, int64(len(top))}
	for i := 0; i < len(top); i++ {
		out = append(out, int64(top[i]))
	}
	return out
}

func Emit(res any, sink func(int64)) {
	for _, v := range res.([]int64) {
		sink(v)
	}
}
  1. Build and run.
    build
    mkdir -p /work/bin/go-1.26-go-default-file-processing.d && cp /repo/languages/go/harness/harness.go /work/bin/go-1.26-go-default-file-processing.d/harness.go && cp /repo/languages/go/impl/file-processing/main.go /work/bin/go-1.26-go-default-file-processing.d/problem.go && go build -o /work/bin/go-1.26-go-default-file-processing /work/bin/go-1.26-go-default-file-processing.d/harness.go /work/bin/go-1.26-go-default-file-processing.d/problem.go
    run
    /work/bin/go-1.26-go-default-file-processing
    kernel loop
    The harness reads and decodes an instance (untimed), times only solve with the language's monotonic clock, and repeats until the summed kernel time reaches 10 s (at least 3 iterations, no other cap). The first iteration is the cold time; the warm time is the median of the iterations after the first 2 s of kernel time. Memory is read from the container's cgroup by a sampler outside the process.
    end-to-end
    hyperfine runs the same binary for exactly one iteration (process start to exit, with the instance read from a file) and records wall-clock time and peak resident memory; reported next to the kernel time.
    binary size
    2.9 MB
  2. Many sessions, many iterations. The benchmark was measured in 3 independent sessions between 2026-10-27 and 2026-10-27, on 2 CPU models. Within a session the execution order of all benchmarks was randomised. Each dot below is one warm kernel iteration (at most 100 evenly spaced ones per session are shown); the black bar is the session median; orange dots are flagged outliers (kept in the data).
151 ms166 ms182 ms197 ms212 ms2026-10-27 · AMD EPYC 7763 64-Core49 iterations · median 205 ms2026-10-27 · AMD EPYC 9V74 80-Core64 iterations · median 157 ms2026-10-27 · AMD EPYC 9V74 80-Core53 iterations · median 189 ms

Warm-up curve

Kernel time of every iteration in order, one line per session (log axis; orange dot: the cold first iteration). Just-in-time and garbage-collected runtimes need a while to settle; compiled languages are flat from the start.

150 ms164 ms179 ms196 ms215 msiteration 1 (cold)last iteration
SessionCPUIterationsColdWarm medianEnd-to-endMachine factorWarm ÷ factorAvg. / peak memorySource
2026-10-27AMD EPYC 7763 64-Core Processor (4 cores)49209 ms205 ms211 ms1.058×193 ms6.3 MB / 6.8 MBActions run · raw data · commit
2026-10-27AMD EPYC 9V74 80-Core Processor (4 cores)64159 ms157 ms161 ms0.892×176 ms6.0 MB / 6.7 MBActions run · raw data · commit
2026-10-27AMD EPYC 9V74 80-Core Processor (4 cores)53195 ms189 ms195 ms1.079×175 ms6.4 MB / 7.1 MBActions run · raw data · commit

The table is computed from the raw values: download every iteration and repetition of this benchmark (CSV), or the complete session files linked above. Each “Warm median” is the median of the kernel iterations after the first 2 s; “÷ factor” divides it by the machine factor.

  1. Cancelling out the hardware. GitHub gives every session a different computer, and some are faster than others, so raw times from different sessions cannot be compared directly. To fix that, every session gets a machine factor: how many times longer programs take on that machine than on the average machine. A factor of 1.2 means “20% slower than average”. We find these factors by looking at benchmarks that ran in several sessions: if the same programs are consistently 20% slower in one session, that machine is 1.2× slower. The factors for this benchmark's sessions are 1.058×, 0.892×, 1.079× (click a date in the table above for the session's details). Technically: we fit log(time) = benchmark + machine across all 8 sessions at once; see the methodology.
  2. Combining sessions. Sessions, not iterations, are the independent samples. Each session's warm median divided by its machine factor (193 ms, 176 ms, 175 ms) is averaged geometrically: 181 ms on the average machine (kernel (warm)). The 95% interval 175 ms–193 ms comes from a cluster bootstrap that resamples sessions, then iterations within each.
  3. Index vs fastest. 1.25× = this time ÷ the time of the fastest entry on the same problem, c 14 gcc-O3-native (145 ms); interval 1.20×–1.33×.
  4. How much was hardware? Raw session medians differ by a geometric factor of 1.146; after dividing out the machine factors they differ by 1.059. The overall model leaves 1.057× of unexplained noise.
  5. Memory. A sampler on the host reads the anonymous memory of the container's cgroup every few milliseconds. The average is weighted by time over the timed kernel regions only (instance generation and decoding excluded), then averaged over sessions: 6.2 MB; the highest value seen was 7.1 MB.

Reproduce it

git clone https://github.com/StijnRis/language-bench.git && cd language-bench
pnpm install
pnpm lb verify go --version 1.26 --variant go-default --problems file-processing

Needs Docker. The command builds the harness and the program in the pinned image and checks the result against the generator's reference; the full timed measurement runs in CI sessions. The parameters of the problem are none.