ozontech / ozontech/seq-db

Tidy up benchmarks

Open
#263 2 comments 0 reactions 1 assignee View on GitHub

@dkharms is already working on this.

Since Nov 18, 2025.

benchmarks
Dominant language
Go
Stars
131
Forks
16
Avg merge
2d 4h
Merged PRs (30d)
11

Description

There are several things we need to fix.

Since go 1.24 pereferable way to write benchmarks is to use b.Loop. We have a lot of benchmark functions which use b.N and some of them rely on b.N value which is incorrect.

Some benchmarks are just useless (take a look at node.BenchmarkCopy). We need to get rid of such benchmarks. Not just because they are useless but also some of them take a lot of time to execute (they are too fast and it takes time for testing package to figure out number of iterations to reach duration of 1 second).

Some of benchmarks are incorrect. For example, node.BenchmarkOr. Node size depends on b.N and therefore (on some laptops) such benchmarks never converge. Here is article by Dave Cheney (https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go) - take a look at Traps for young players section. Also for some benchmarks (again node.BenchmarkCopy) compiler optimizes away all the code.

  • use b.Loop everywhere;
  • remove useless benchmarks;
  • do not rely on b.N;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.