Repository navigation
perf: compare variable and attribute names in place - #78
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Beforerr
force-pushed
the
perf-name-lookup
branch
from
October 6, 2026 13:42
218bba2 to
7a58f0d
Compare
NOVARY dimensions aren't physically stored, so counting them read past each variable's data. r-variables already dropped them; z-variables now share that path. Matches CDFpp and cdflib.
Lookups by name scanned each record's name field for its terminator and compared a view element-wise; attribute lookup also parsed every ADR first. Compare with one memcmp in the buffer instead, and read an ADR's name only when it is returned. Name fields are 64 bytes in CDF v2, not 256, so a v2 name filling its field was read into the following bytes.
Beforerr
force-pushed
the
perf-name-lookup
branch
from
October 6, 2026 13:53
7a58f0d to
8c11b75
Compare
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.
Stacked on #77.
Name lookups (
ds[name],haskey,var.attrib[name],attrib(ds, name)) scanned each record's name field for its terminator and compared a view element-wise; attribute lookup also parsed every ADR first. Now onememcmpin the buffer, checking the terminator right after the requested length.ADRkeeps the name's position instead of reading it, so the name is read only when returned (adr_name). First-call time is unchanged: 175–177 ms for openingac_h0_mfiand reading every variable's attributes, before and after.Looking up every variable / every variable attribute, before → after:
ds[k]all varsv.attrib[a]allAlso: name fields are 64 bytes in CDF v2 (cdflib, CDFpp
cdf_string_field_t<version_t, 256, 64>), not 256, soreadnameread a v2 name filling its field into the following bytes. It only shows on v2 r-variables with dimensions, where DimVarys (-1) follows the name; no fixture has one.Full suite passes, including JET and trim.