Skip to content

Eliminate harness measurement distortion in TransferCache benchmarks. - #1022

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_984204084
Sep 21, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_984204084

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Sep 19, 2026

Copy link
Copy Markdown

Eliminate harness measurement distortion in TransferCache benchmarks.

BM_InsertRange, BM_RemoveRange, BM_RealisticBatchNonBatchMutations, and
BM_RealisticHitRate in transfer_cache_benchmark invoked state.PauseTiming()
and state.ResumeTiming() inside every iteration of the benchmark loop,
spending ~60% of CPU cycles in clock_gettime/vDSO syscall overhead (~1300 ns/iter)
and obscuring the underlying 10-30 ns cache operations. In addition,
FakeTransferCacheEnvironment::Insert and Remove allocated temporary std::vector
instances on the heap in each call.

Amortize setup across batches with state.KeepRunningBatch in BM_InsertRange and
BM_RemoveRange, precompute PRNG decisions in BM_RealisticBatchNonBatchMutations
and BM_RealisticHitRate using compile-time constant modulo, and replace dynamic
std::vector buffers with stack arrays in FakeTransferCacheEnvironment.

@copybara-service
copybara-service Bot force-pushed the test_984204084 branch 2 times, most recently from 9b40bdc to 4d15072 Compare September 21, 2026 20:09
BM_InsertRange, BM_RemoveRange, BM_RealisticBatchNonBatchMutations, and
BM_RealisticHitRate in transfer_cache_benchmark invoked state.PauseTiming()
and state.ResumeTiming() inside every iteration of the benchmark loop,
spending ~60% of CPU cycles in clock_gettime/vDSO syscall overhead (~1300 ns/iter)
and obscuring the underlying 10-30 ns cache operations. In addition,
FakeTransferCacheEnvironment::Insert and Remove allocated temporary std::vector
instances on the heap in each call.

Amortize setup across batches with state.KeepRunningBatch in BM_InsertRange and
BM_RemoveRange, precompute PRNG decisions in BM_RealisticBatchNonBatchMutations
and BM_RealisticHitRate using compile-time constant modulo, and replace dynamic
std::vector buffers with stack arrays in FakeTransferCacheEnvironment.
PiperOrigin-RevId: 985469423
@copybara-service
copybara-service Bot merged commit ebd7553 into master Sep 21, 2026
2 checks passed
@copybara-service
copybara-service Bot deleted the test_984204084 branch September 21, 2026 20:18

This branch was successfully deployed

1 active deployment
github-pages ebd7553e Deployed Sep 21, 2026 by github-pages[bot] via deploy #2755
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