Skip to content

Conversation

@tomas-zijdemans
Copy link
Contributor

@tomas-zijdemans tomas-zijdemans commented Dec 29, 2025

Optimize minBy and maxBy performance by:

  • Adding an array fast path that uses index-based iteration instead of iterators
  • Extracting the first element to remove the undefined check from the hot loop

Benchmarks show improvements ranging from ~7% for generators to ~4x for small arrays, with most array operations seeing ~1.3-2x improvement.

@tomas-zijdemans tomas-zijdemans changed the title refactor(collections): optimize minBy/maxBy with fast array paths perf(collections): optimize minBy/maxBy with fast array paths Dec 29, 2025
@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.18%. Comparing base (13e5527) to head (0f16b94).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6919      +/-   ##
==========================================
+ Coverage   94.17%   94.18%   +0.01%     
==========================================
  Files         584      584              
  Lines       43087    43127      +40     
  Branches     6875     6891      +16     
==========================================
+ Hits        40578    40621      +43     
+ Misses       2457     2455       -2     
+ Partials       52       51       -1     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant