]> git.eshelyaron.com Git - emacs.git/commit
Speed up `sort` by special-casing the `value<` ordering
authorMattias EngdegÄrd <mattiase@acm.org>
Thu, 21 Mar 2024 18:35:15 +0000 (19:35 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 29 Mar 2024 12:33:32 +0000 (13:33 +0100)
commitbbe8ce0d6f1ffd0e03091cbfa4171090104e2690
treeb25a84ceb834bcb259084deadd2c6334abca000e
parentb3d388dced8e29ed0808213ffa0a12fe750c7dd1
Speed up `sort` by special-casing the `value<` ordering

This gives a 1.5x-2x speed-up when using the default :lessp value,
by eliminating the Ffuncall overhead.

* src/sort.c (order_pred_lisp, order_pred_valuelt): New.
(merge_state, inorder, binarysort, count_run, gallop_left, gallop_right)
(merge_init, merge_lo, merge_hi, tim_sort):
* src/fns.c (Fsort):
When using value<, call it directly.

(cherry picked from commit deae311281522864ebabaf56adafbe37032cc8a9)
src/fns.c
src/sort.c