Skip to content

Add Goose tests - #520

Open
aardappel wants to merge 1 commit into
kostya:masterfrom
aardappel:add-goose
Open

aardappel wants to merge 1 commit into
kostya:masterfrom
aardappel:add-goose

Conversation

@aardappel

Copy link
Copy Markdown

Goose compiles a whole program to one C
file, which these tests build with the suite's CLANG_FLAGS (-std=c23
included), so they report as "Goose/clang". All five tests are here:

  • brainfuck/bf.goose: the op tree and growing tape of bf.rs, run
    recursively; flushes after every character unless QUIET is set.
  • base64/test.goose: the standard library's base64 codec, a new buffer
    per call.
  • json/test.goose ("Goose/clang (Typed)"): the standard library's
    json::Reader maps the text onto a Coordinate array, as serde's derive
    does. json/test_dom.goose ("Goose/clang (DOM)"): its document tree, like
    serde's Value or RapidJSON's Document.
  • matmul/matmul.goose: the loop order of matmul.jl
    (c[i][j] += a[i][k] * b[k][j] with j innermost, no threads) rather
    than plb's transposed dot products. Every cell adds the same products in
    the same order, so it prints exactly what matmul.rs prints.
  • primes/primes.goose: the sieve of Atkin, a trie of the digits and a
    breadth-first walk, as in primes.rs. One difference for the README's
    notes: Goose's hash map grows, and a growable value cannot be an element of
    an array, which every trie node is, so a node's children are an unordered
    run of at most ten (digit, node) pairs, looked up by scanning, as Zig's
    array_hash_map does below eight entries.

Goose has no sockets of its own, so common/goose/notify.h hands the two
notify messages to common/libnotify (Goose calls C through extern fn, and
goose --include puts the header into the generated C).

Build: GOOSE_BUILD in common/commands.mk (with -w, since the generated C
carries runtime helpers a given test does not use), a rule per test, and a
Dockerfile step that builds goose from source at a pinned commit with the
image's CMake and clang++; versions.rb reports that commit.

Checked on Ubuntu 24.04 with clang 20: every Goose target builds with its
Makefile rule and prints what the Rust and C tests print (Brainfuck byte for
byte, the same primes, the same matmul result). The Dockerfile's Goose step,
run in debian:forky-20260713-slim with the image's clang-22, cmake and
build-essential, builds the compiler, and the Primes, Brainfuck and Matmul
rules then build and run there. I have not built the full image.

For reference, my numbers on that Ubuntu (WSL 2 on a Ryzen 9 9950X3D), in
seconds: the suite's flags, timed between the notify messages, median of 7
runs interleaved with the C, C++ and Rust tests built the same way (C++
against libstdc++, as that machine has no libc++):

test Goose C C++ Rust
bench.b 0.75 0.80 0.75 0.72
mandel.b 8.72 9.20 9.19 9.88
base64 0.088 0.61, aklomp 0.044 0.47
json 0.061, DOM 0.082 yyjson 0.074 simdjson 0.040, RapidJSON 0.131 serde typed 0.079
matmul 0.234 2.48 1.34
primes 0.033 0.037 0.085

The script that measured these, with notes on the results, is in the Goose
repository under
bench/kostya2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant