failureBreakpoint() currently has optimizations disabled which produces some significant assembly for what's supposed to be a no-op. Enabling optimizations and marking its magic value as @exclusivity(unchecked) reduces it to a single indirect store.
This is probably not the hottest hot path in the library (since it will only be called when a test is failing) but the whole point of the function is to be a no-op, and without this change it's quite noisy and includes a whole function call into the Swift runtime (see the bl instructions below.)
Note this disassembly comes from the intermediate .o file generated for the relevant source file, so addresses aren't available yet. Neither function actually attempts to write to 0x0.
Checklist:
[x] Code and documentation should follow the style of the Style Guide.
[x] If public symbols are renamed or modified, DocC references should be updated.
failureBreakpoint()
currently has optimizations disabled which produces some significant assembly for what's supposed to be a no-op. Enabling optimizations and marking its magic value as@exclusivity(unchecked)
reduces it to a single indirect store.This is probably not the hottest hot path in the library (since it will only be called when a test is failing) but the whole point of the function is to be a no-op, and without this change it's quite noisy and includes a whole function call into the Swift runtime (see the
bl
instructions below.)arm64
Before
After
Note this disassembly comes from the intermediate .o file generated for the relevant source file, so addresses aren't available yet. Neither function actually attempts to write to 0x0.
Checklist: