mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-24 08:21:32 +01:00
[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 <codex@openai.com>
This commit is contained in:
1 parent
4daafa0767
commit
375b3f4b33
1 file changed
+2
-5
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user