mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
URLSearchParams.sort() copies both merge runs into temporary arrays. Buffer only the left run and read the right run from the output array, removing one scratch-array allocation and the right-run copying. While left-side elements remain, the output cursor stays behind unread right-side elements. Once the left run is exhausted, the right remainder is already in place. Taking the left key on equality preserves stability. The insertion-sort path below 50 pairs is unchanged. Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com> PR-URL: https://github.com/nodejs/node/pull/66665 Reviewed-By: Xuguang Mei <meixuguang@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>