Skip to content

Disable allocation zeroing in benchmarks on Android#2214

Open
charlesmunger wants to merge 1 commit into
google:mainfrom
charlesmunger:patch-1
Open

Disable allocation zeroing in benchmarks on Android#2214
charlesmunger wants to merge 1 commit into
google:mainfrom
charlesmunger:patch-1

Conversation

@charlesmunger
Copy link
Copy Markdown

This is particularly problematic because large allocations partially used can get eagerly memset even if they hit the backing allocator, faulting in a ton of pages, so the behavior can diverge substantially from real in-app performance.

This is particularly problematic because large allocations partially used can get eagerly memset even if they hit the backing allocator, faulting in a ton of pages, so the behavior can diverge substantially from real in-app performance.
@LebedevRI
Copy link
Copy Markdown
Collaborator

I'm a bit confused by the diff.
Is the idea to disable hardening features to measure the best-case performance,
or because benchmarks happen to have hardening enabled, unlike the real production?
(Latter case seems especially weird to me, is hardening not specifically for the production?)

@dmah42
Copy link
Copy Markdown
Member

dmah42 commented May 28, 2026

my understanding is that this is intended to mimic production allocation behaviour for various android versions.

@LebedevRI
Copy link
Copy Markdown
Collaborator

(I don't have a leg in this either way, i just feel like the actual ansver is something that should be documented at least here as an issue comment.)

@charlesmunger
Copy link
Copy Markdown
Author

Is the idea to disable hardening features to measure the best-case performance,
or because benchmarks happen to have hardening enabled, unlike the real production?

This hardening feature is on by default, but disabled for application processes, so in practice only system services built into the OS have it on. However, the disabling happens at runtime during the initialization of application processes before they load code, and a benchmark binary doesn't have that, so it runs in the "default" misleading configuration.

https://android.googlesource.com/platform/bionic/+/HEAD/docs/defines.md

The idea is that benchmark binaries built with the toolchain used to build apps should perform the way the code would if it was compiled into an app.

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.

3 participants