mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
5364c4167e
when all elements are integers and no block is given, use specialized heapify/insertion_sort that compare mrb_int values directly, bypassing sort_cmp entirely. this eliminates per-comparison overhead of GC arena save/restore, type checking, and array modification checks. the pre-scan to detect all-integer arrays is O(n), negligible compared to O(n log n) sort. non-integer and block sorts are unaffected. Co-authored-by: Claude <noreply@anthropic.com>