Skip to content

zeroize: remove internal use of optimization_barrier - #1535

Open
tarcieri wants to merge 1 commit into
masterfrom
zeroize/remove-internal-use-of-optimization-barrier
Open

zeroize: remove internal use of optimization_barrier#1535
tarcieri wants to merge 1 commit into
masterfrom
zeroize/remove-internal-use-of-optimization-barrier

Conversation

@tarcieri

@tarcieri tarcieri commented Sep 9, 2026

Copy link
Copy Markdown
Member

We replaced our previous use of compiler fences with optimization_barrier under the assumption it would be a zero-cost abstraction, but per #1504 that is not the case as it caused a performance regression.

The use of either of these was effectively redundant and a belt-and-suspenders defense as volatile writes alone are already sufficient to guarantee zeroization will not be removed by the compiler.

This removes the use of optimization_barrier to restore the previous performance.

Closes #1504.

@tarcieri
tarcieri force-pushed the zeroize/remove-internal-use-of-optimization-barrier branch from c788dab to e8fa876 Compare September 9, 2026 16:20
We replaced our previous use of compiler fences with
`optimization_barrier` under the assumption it would be a zero-cost
abstraction, but per #1504 that is not the case as it caused a
performance regression.

The use of either of these was effectively redundant and a
belt-and-suspenders defense as volatile writes alone are already
sufficient to guarantee zeroization will not be removed by the compiler.

This removes the use of `optimization_barrier` to restore the previous
performance.

Closes #1504.
@tarcieri
tarcieri force-pushed the zeroize/remove-internal-use-of-optimization-barrier branch from e8fa876 to e4f62e9 Compare September 9, 2026 16:21
@tarcieri

tarcieri commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@ctz if you can take a look it would be good to confirm this closes #1504

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.

zeroize 1.8.2 -> 1.9.0 performance regression

1 participant