perf: static-arity dims in variable() + fix StaticString null padding#45
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
055617c to
d1a4842
Compare
…le reads
variable() branches over the record-dim count and the data-type code so
CDFVariable construction is fully static: no _apply_iterate splat, no
generic-dispatch lookup, no argument boxing (elx var_access 861->195 ns,
6->4 allocs, 544->384 B).
CDFVariable drops the VDR/dataset type parameters (union fields); a typed
destination then pins the complete CDFVariable{T,N}, making read!(var, dest)
and read(var, Array{T,N}) resolve statically under juliac --trim even though
ds[name] is runtime-typed. Array{T,N}(var) constructors added for native use
(not trim-resolvable: Base convert-constructors compete).
Also fixes StaticString null padding.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
d1a4842 to
f82a335
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.
variable(): @nif branch over num_record_dims (CDF caps at 10) -> dims tuple arity known at compile time.
staticstring: isvalid calls Base._thisind_str direct, delete local copy + Base.thisind override (invalidated 476 Base MethodInstances at load).
staticstring: ncodeunits trims trailing-null padding so length/collect/String/isvalid agree with iterate; collect on padded strings returned undef garbage before.