Skip to content

Conversation

@tomas-zijdemans
Copy link
Contributor

Optimizes minOf and maxOf to use the same pattern as minBy/maxBy:

  • Fast path for arrays using index-based iteration
  • Manual iterator for non-array iterables

Benchmark results (100K elements):

  • Identity selector: ~3% faster (marginal)
  • Object property selector: ~20% faster
  • BigInt: ~22-25% faster
  • Generator/Iterable: ~25% faster
  • Small arrays (10 elements): up to 3x faster

Added tests for iterable inputs, single-element arrays, and NaN-as-first-element.

@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

❌ Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.22%. Comparing base (4b413cf) to head (1d4a1a5).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
collections/max_of.ts 96.29% 0 Missing and 1 partial ⚠️
collections/min_of.ts 96.29% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6936   +/-   ##
=======================================
  Coverage   94.22%   94.22%           
=======================================
  Files         584      584           
  Lines       43124    43162   +38     
  Branches     6899     6918   +19     
=======================================
+ Hits        40634    40670   +36     
  Misses       2439     2439           
- Partials       51       53    +2     

☔ 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.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice!

@kt3k kt3k merged commit 29d1698 into denoland:main Jan 7, 2026
19 checks passed
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.

2 participants