Skip to content

CAT 005

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-005 — shift/unshift → Deque

Severity: info | Confidence: high | Auto-fix:

Description

shift/unshift → Deque — Using Array#shift or Array#unshift is O(n). Use Deque for O(1) front operations.

Bad code

ary.unshift(x)
ary.shift

Benchmark

Note

See bench results at bench/cat-005/

Clone this wiki locally