From da7b66c1f8bbf7147f8113922f81c02002af818c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 27 Jan 2023 16:39:06 -0700 Subject: [PATCH] [layout] Optimize buffer message calls Those aren't exactly free. They were showing up in profiles. --- src/hb-ot-layout.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 0dc5bf254..7a0d026a7 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1959,7 +1959,8 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, auto &lookup = lookups[table_index][i]; unsigned int lookup_index = lookup.index; - if (!buffer->message (font, "start lookup %u feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag))) continue; + if (buffer->messaging () && + !buffer->message (font, "start lookup %u feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag))) continue; /* c.digest is a digest of all the current glyphs in the buffer * (plus some past glyphs). @@ -1978,10 +1979,11 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, proxy.table.get_lookup (lookup_index), proxy.accels[lookup_index]); } - else + else if (buffer->messaging ()) (void) buffer->message (font, "skipped lookup %u feature '%c%c%c%c' because no glyph matches", lookup_index, HB_UNTAG (lookup.feature_tag)); - (void) buffer->message (font, "end lookup %u feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag)); + if (buffer->messaging ()) + (void) buffer->message (font, "end lookup %u feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag)); } if (stage->pause_func)