Skip to content

CAT 001

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-001 — sort.first → min/max

Severity: warningConfidence: highAuto-fix:

Tip

This rule supports auto-fix via --fix

Description

sort.first → min/max — Use min/max instead of sort/first/last to avoid O(n log n) sorting when O(n) scanning suffices.

Bad code

ary.sort.first
ary.sort.last

Good code

ary.min
ary.max

Performance Impact

Tip

This rule can significantly improve performance in hot code paths.

Benchmark

Note

See bench results at bench/cat-001/

Clone this wiki locally