From 375b3f4b334c3f2dabf0d8b23ca9aecf99686a10 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 20 Aug 2026 03:48:08 -0600 Subject: [PATCH] [depend] Combine edge deduplication lookup and insert Use a non-overwriting hashmap insertion to detect duplicate dependency edges. This avoids hashing and probing every newly inserted edge twice, while still distinguishing duplicates from allocation failures through the hashmap error state. The NotoNastaliqUrdu compile-only dependency workload saves about 2.2M instructions. Its wall-time change is below measurement noise. Tested with: meson test -C build Assisted-by: OpenAI Codex --- src/hb-depend-data.hh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/hb-depend-data.hh b/src/hb-depend-data.hh index a752e0e77..ebb13fd1f 100644 --- a/src/hb-depend-data.hh +++ b/src/hb-depend-data.hh @@ -470,11 +470,8 @@ struct hb_depend_data_builder_t } hb_depend_edge_key_t key (target, table_tag, layout_tag, dependent, lig_set, context_set); - if (seen_edges.has (key)) - return false; - - if (unlikely (!seen_edges.set (key, true))) - return fail (); + if (!seen_edges.set (key, true, false)) + return unlikely (seen_edges.in_error ()) ? fail () : false; auto &gdr = data.glyph_dependencies[target]; if (unlikely (!gdr.dependencies.push_or_fail (table_tag, dependent, layout_tag,