Skip to content

feat(hostname): add benchmark with large /etc/hosts#10979

Open
naoNao89 wants to merge 1 commit intouutils:mainfrom
naoNao89:feature/hostname-benchmark-10949
Open

feat(hostname): add benchmark with large /etc/hosts#10979
naoNao89 wants to merge 1 commit intouutils:mainfrom
naoNao89:feature/hostname-benchmark-10949

Conversation

@naoNao89
Copy link
Contributor

Add benchmarks for hostname utility with large hosts files.

Tests all flags (-s, -d, -f, -i) with 1K/10K/100K entries (includes NSS_WRAPPER support for testing generated hosts files)

Closes #10949

/// This benchmarks the underlying DNS lookup without the full hostname command overhead
#[cfg(not(any(target_os = "freebsd", target_os = "openbsd")))]
#[divan::bench(
args = [1_000, 10_000, 100_000],
Copy link
Contributor

Choose a reason for hiding this comment

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

just pass one value
it isn't interesting to have several

/// To test with the generated large hosts file, run with NSS_WRAPPER:
/// `LD_PRELOAD=/usr/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=/path/to/hosts cargo bench`
#[divan::bench(
args = [1_000, 10_000, 100_000],
Copy link
Contributor

Choose a reason for hiding this comment

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

same, one value please

@github-actions
Copy link

GNU testsuite comparison:

Note: The gnu test tests/cut/bounded-memory is now being skipped but was previously passing.

@naoNao89 naoNao89 force-pushed the feature/hostname-benchmark-10949 branch from 5098b5e to b63fc94 Compare February 16, 2026 16:20
@sylvestre
Copy link
Contributor

please keep only 2 or 3 benchmarks. we don't need that many
thanks

@naoNao89
Copy link
Contributor Author

hmm keep only 3:

  • hostname_ip_lookup
  • hostname_basic
  • socket_addrs_direct (or dns_lookup_direct for BSD) to compare library perf

@naoNao89 naoNao89 force-pushed the feature/hostname-benchmark-10949 branch 2 times, most recently from 653b942 to 8a43ab6 Compare February 16, 2026 16:27
Adds comprehensive benchmarks for the hostname utility, including:
- Realistic hosts file generation with various hostname patterns
- Benchmarks for all flags: -s, -d, -f, -i
- Parameterized tests with 1K, 10K, 100K entries
- NSS_WRAPPER support for testing with generated hosts files
- CI integration for automated benchmark tracking

Fixes uutils#10949
@naoNao89 naoNao89 force-pushed the feature/hostname-benchmark-10949 branch from 8a43ab6 to 087ccf0 Compare February 16, 2026 16:29
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/rm/isatty. tests/rm/isatty is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/misc/io-errors is no longer failing!
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.

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.

hostname: Add benchmark with large /etc/hosts

2 participants