Skip to content

perf: only allocate a single map in Intersect#736

Merged
samber merged 5 commits intosamber:masterfrom
NathanBaulch:intersectperf
Nov 6, 2025
Merged

perf: only allocate a single map in Intersect#736
samber merged 5 commits intosamber:masterfrom
NathanBaulch:intersectperf

Conversation

@NathanBaulch
Copy link
Contributor

#181 recently improved the lo.Intersect helper by making it variadic, an improvement I had also made to the it.Intersect version. This PR "aligns" the two implementations so that the slice version only allocates a single map instead of N+1 maps.

frankywahl and others added 3 commits November 6, 2025 07:44
This will ignore the ordering of the final intersection. Especially
important when checking old versions of go that do not guarantee an order
when iterating through maps.
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.25%. Comparing base (3f2e24e) to head (8838486).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #736      +/-   ##
==========================================
+ Coverage   94.15%   94.25%   +0.09%     
==========================================
  Files          18       18              
  Lines        2789     2801      +12     
==========================================
+ Hits         2626     2640      +14     
+ Misses        148      147       -1     
+ Partials       15       14       -1     
Flag Coverage Δ
unittests 94.25% <100.00%> (+0.09%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@samber samber merged commit 4782f59 into samber:master Nov 6, 2025
11 checks passed
@NathanBaulch NathanBaulch deleted the intersectperf branch November 6, 2025 19:51
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.

3 participants