From a878dca00f2d27b8f1c4e0a040f7e63c68faf0b9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 12 Sep 2025 19:19:07 -0600 Subject: [PATCH] [instancer/varstore] Remove sorting from the optimizer Just work with incoming order. --- src/hb-ot-layout-common.hh | 16 ---------------- src/hb-ot-var-common.hh | 5 ----- 2 files changed, 21 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 7248d2697..9c0eb63a1 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -2386,11 +2386,6 @@ struct delta_row_encoding_t return cols; } - int cmp (const chars_t& other) const - { - return as_array ().cmp (other.as_array ()); - } - hb_pair_t get_width () { unsigned width = 0; @@ -2485,17 +2480,6 @@ struct delta_row_encoding_t return combined_gain; } - static int cmp (const void *pa, const void *pb) - { - const delta_row_encoding_t *a = (const delta_row_encoding_t *)pa; - const delta_row_encoding_t *b = (const delta_row_encoding_t *)pb; - - if (a->width != b->width) - return (int) a->width - (int) b->width; - - return b->chars.cmp (a->chars); - } - bool add_row (const hb_vector_t* row) { return items.push (row); } }; diff --git a/src/hb-ot-var-common.hh b/src/hb-ot-var-common.hh index b03efff41..8cfdf5d1f 100644 --- a/src/hb-ot-var-common.hh +++ b/src/hb-ot-var-common.hh @@ -1877,8 +1877,6 @@ struct item_variations_t * is a compromise between optimization and performance and practically * works very well. */ - /* sort encoding_objs */ - encoding_objs.qsort (); /* main algorithm: repeatedly pick 2 best encodings to combine, and combine them */ using item_t = hb_priority_queue_t::item_t; @@ -1953,9 +1951,6 @@ struct item_variations_t encodings.push (std::move (encoding_objs.arrayZ[i])); } - /* sort again based on width, make result deterministic */ - encodings.qsort (); - return compile_varidx_map (front_mapping); }