[ot-map] Speed up for default shaper

Sort late, the reduced number of features.
This commit is contained in:
Behdad Esfahbod committed 2023-07-02 16:53:41 -06:00
1 parent 8156c5a685
commit de2c10732d
3 files changed
+19 -2

No files matched your search

+4 -2
View File
@@ -213,7 +213,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
/* Sort features and merge duplicates */
if (feature_infos.length)
{
feature_infos.qsort ();
if (!is_simple)
feature_infos.qsort ();
auto *f = feature_infos.arrayZ;
unsigned int j = 0;
unsigned count = feature_infos.length;
@@ -314,7 +315,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
map->needs_fallback = !found;
}
//feature_infos.shrink (0); /* Done with these */
if (is_simple)
m.features.qsort ();
add_gsub_pause (nullptr);
add_gpos_pause (nullptr);
+8
View File
@@ -60,6 +60,13 @@ struct hb_ot_map_t
int cmp (const hb_tag_t tag_) const
{ return tag_ < tag ? -1 : tag_ > tag ? 1 : 0; }
HB_INTERNAL static int cmp (const void *pa, const void *pb)
{
const feature_map_t *a = (const feature_map_t *) pa;
const feature_map_t *b = (const feature_map_t *) pb;
return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0;
}
};
struct lookup_map_t {
@@ -273,6 +280,7 @@ struct hb_ot_map_builder_t
hb_face_t *face;
hb_segment_properties_t props;
bool is_simple;
hb_tag_t chosen_script[2];
bool found_script[2];
+7
View File
@@ -313,6 +313,8 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
{
hb_ot_map_builder_t *map = &planner->map;
map->is_simple = true;
map->enable_feature (HB_TAG('r','v','r','n'));
map->add_gsub_pause (nullptr);
@@ -354,7 +356,10 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
map->enable_feature (HB_TAG ('H','A','R','F')); /* Considered discretionary. */
if (planner->shaper->collect_features)
{
map->is_simple = false;
planner->shaper->collect_features (planner);
}
map->enable_feature (HB_TAG ('B','u','z','z')); /* Considered required. */
map->enable_feature (HB_TAG ('B','U','Z','Z')); /* Considered discretionary. */
@@ -378,6 +383,8 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
map->enable_feature (HB_TAG ('v','e','r','t'), F_GLOBAL_SEARCH);
}
if (num_user_features)
map->is_simple = false;
for (unsigned int i = 0; i < num_user_features; i++)
{
const hb_feature_t *feature = &user_features[i];