perf: hoist cap==0 check off full emplace - #2
Merged
Conversation
GCC 13 was calling EQZ_COLD ensure_writable on every overwrite. Keep the throw out of line; only invoke it when capacity is 0. Co-authored-by: Cursor <cursoragent@cursor.com>
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full
emplace_back/emplace_frontno longercall EQZ_COLD ensure_writable()on every overwrite. The helper runs only whencapacity()==0(still throwsstd::length_error).Closes the GCC 13 hot-path hole from Investigate GCC 13 bench gap versus Clang #1 without inlining
throwintoemplace_*.DESIGN.md matches the new shape and records the discarded R2/R3 variants (drop
EQZ_COLD/ always-inline check + cold throw helper), which sped up overwrite but sent GCCcopy/fullto ~11 µs.Adds docs/BENCH.md: keep-or-revert, local vs remote
release-bench, and how to read GCC/Clang ratios. Issues and PR bodies are English (CONTRIBUTING.md,CODING_STANDARDS.md).Closes Investigate GCC 13 bench gap versus Clang #1
Test plan
capacity()==0push_backstill throwslength_errorbench/r1-hoist-cap0full CI matrix greenrelease-benchvs main56fb5af:slide/u64/40975.02 ns → 0.61 ns; geomean 1.29 → 1.10 (0.90 iftry_push/fulltimer-floor 469× is excluded)copy/full814 ns → ~11 µstry_push/fullon GCC going 0.01 ns → 0.70 ns (Boost still 0.00) poisons geomean; it is not an overwrite regression