Skip to content

Comments

kaizen: Add BenchmarkShellStyleBuildTime using testing.B#495

Merged
timbray merged 3 commits intotimbray:mainfrom
sayrer:pr/shell_style_build_time
Feb 19, 2026
Merged

kaizen: Add BenchmarkShellStyleBuildTime using testing.B#495
timbray merged 3 commits intotimbray:mainfrom
sayrer:pr/shell_style_build_time

Conversation

@sayrer
Copy link
Contributor

@sayrer sayrer commented Feb 18, 2026

Convert the manual TestShellStyleBuildTime timing into a proper Go 1.24 b.Loop() benchmark. Uses 1000 shell-style wildcard patterns merged onto a single field, producing an automaton with 7409 tables and up to 900 epsilons—a stress test for NFA traversal at scale. First step for #494.

Also widen readWWords to accept testing.TB so it works from both tests and benchmarks.

sayrer and others added 2 commits February 18, 2026 14:35
Convert the manual TestShellStyleBuildTime timing into a proper
Go 1.24 b.Loop() benchmark. Uses 1000 shell-style wildcard patterns
merged onto a single field, producing an automaton with 7409 tables
and up to 900 epsilons—a stress test for NFA traversal at scale.

Also widen readWWords to accept testing.TB so it works from both
tests and benchmarks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v2_bench_test.go Outdated
}

func BenchmarkShellStyleBuildTime(b *testing.B) {
words := readWWords(b)[:1000]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are almost 13K words in that file, I've been meaning for months to parameterize the readWords function so we don't read 13K and throw away 12K. Pretty please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Add maxWords parameter so callers that only need a subset (1000 or
2000 words) don't read all 13K lines from wwords.txt. Pass 0 to
read all words.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@timbray timbray merged commit 4b74c38 into timbray:main Feb 19, 2026
7 checks passed
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.

2 participants