Skip to content

test: fix BenchmarkNova clone setup#57

Open
leno23 wants to merge 1 commit into
dolph:mainfrom
leno23:fix/benchmark-nova-issue-16
Open

test: fix BenchmarkNova clone setup#57
leno23 wants to merge 1 commit into
dolph:mainfrom
leno23:fix/benchmark-nova-issue-16

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • Clone openstack/nova once per benchmark run over HTTPS (no SSH keys required).
  • Use b.Cleanup for temp dir teardown instead of a broken defer inside the helper.
  • Measure only WalkDir in the timed loop.

Closes #16

Made with Cursor

Clone nova once over HTTPS, use b.Cleanup for teardown, and measure
only WalkDir in the benchmark loop.

Closes dolph#16

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c8aa36eeb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread find_replace_test.go
Comment on lines +362 to +365
b.StopTimer()
d := cloneRepoToBenchDir(b, repoURL)
fr := findReplace{find: RandomString(2), replace: RandomString(2)}
b.ResetTimer()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restart benchmark timer before timed loop

BenchmarkNova stops the timer for setup and then calls ResetTimer, but ResetTimer does not start timing again. As written, the loop executes with timing disabled, so WalkDir work is not measured and the benchmark can report misleading numbers (and may over-calibrate b.N because elapsed benchmark time stays near zero). Add b.StartTimer() before entering the loop (or avoid StopTimer/ResetTimer here).

Useful? React with 👍 / 👎.

Comment thread find_replace_test.go
Comment on lines +363 to 367
d := cloneRepoToBenchDir(b, repoURL)
fr := findReplace{find: RandomString(2), replace: RandomString(2)}
b.ResetTimer()

for n := 0; n < b.N; n++ {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Benchmark each iteration against a fresh repository state

This benchmark now clones Nova once and then reuses the same directory for all iterations, but WalkDir mutates file contents and names via replace/rename operations. That means iteration 2+ run on already-modified input, so the measured ns/op no longer reflects the cost on a fresh checkout and will typically trend artificially low after the first pass. Recreate/reset the repo per iteration outside timed sections to keep workloads consistent.

Useful? React with 👍 / 👎.

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.

BenchmarkNova depends on cloning openstack/nova over the network and uses an SSH URL

1 participant