Skip to content

Avoid allocating a String when hashing a lazy tensor - #253

Merged
mtfishman merged 3 commits into
release-0.13from
mf/lazy-hash-typename-0.13
Sep 11, 2026
Merged

mtfishman merged 3 commits into
release-0.13from
mf/lazy-hash-typename-0.13

Conversation

@mtfishman

Copy link
Copy Markdown
Member

Summary

Makes hashing a lazy tensor allocation-free. hash_lazy built its type discriminator with Symbol(Base.typename(typeof(a)).wrapper), and Symbol has no method taking a type, so it fell back to rendering the type through an IOBuffer on every call. nameof gives the same discriminator as a Symbol for free.

mtfishman and others added 2 commits September 10, 2026 19:21
Symbol has no method taking a type, so Symbol(typename(T).wrapper) fell back
to rendering the type through an IOBuffer on every call. nameof gives the
same discriminator as a Symbol for free.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mtfishman
mtfishman enabled auto-merge (squash) September 10, 2026 23:24
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.92%. Comparing base (6a051bd) to head (d72674f).

Additional details and impacted files
@@               Coverage Diff                @@
##           release-0.13     #253      +/-   ##
================================================
+ Coverage         77.37%   77.92%   +0.55%     
================================================
  Files                30       30              
  Lines              1812     1812              
================================================
+ Hits               1402     1412      +10     
+ Misses              410      400      -10     
Flag Coverage Δ
docs 26.30% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mtfishman
mtfishman merged commit e741a1f into release-0.13 Sep 11, 2026
18 checks passed
@mtfishman
mtfishman deleted the mf/lazy-hash-typename-0.13 branch September 11, 2026 02:11
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.

1 participant