-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[buffer] Add flags to disable unsafe-to-concat and unsafe-to-break calculations #3454
Comments
unsafe-to-concat is new enough that we can still change it. |
Closed
This patch is enough to regain much of the lost performance: diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index ee72dfafb..12daeba16 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -377,7 +377,8 @@ typedef enum { /*< flags >*/
HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004u,
HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES = 0x00000008u,
HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE = 0x00000010u,
- HB_BUFFER_FLAG_VERIFY = 0x00000020u
+ HB_BUFFER_FLAG_VERIFY = 0x00000020u,
+ HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT = 0x00000040u
} hb_buffer_flags_t;
HB_EXTERN void
diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh
index cc20f3aef..bc6992905 100644
--- a/src/hb-buffer.hh
+++ b/src/hb-buffer.hh
@@ -460,6 +460,8 @@ struct hb_buffer_t
}
void unsafe_to_concat (unsigned int start = 0, unsigned int end = -1)
{
+ if (likely ((flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT) == 0))
+ return;
_set_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_CONCAT,
start, end,
true);
@@ -472,6 +474,8 @@ struct hb_buffer_t
}
void unsafe_to_concat_from_outbuffer (unsigned int start = 0, unsigned int end = -1)
{
+ if (likely ((flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT) == 0))
+ return;
_set_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_CONCAT,
start, end,
false, true); I suggest I put this in. As I said, unsafe-to-break seems to be much lower overhead and also water-under-the-bridge already. |
behdad
added a commit
that referenced
this issue
Feb 18, 2022
behdad
added a commit
that referenced
this issue
Feb 18, 2022
behdad
added a commit
that referenced
this issue
Feb 18, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In my measurements, disabling those can speedup shaping by up to 17%. Vast majority of clients won't use those flags. Should have been opt-in from the beginning. Oh well. We can allow opt-out now, to allow those browsers, or Android, that don't use it to opt out and save the planet...
Note that most of that overhead is from unsafe-to-concat. unsafe-to-break is much lower-overhead. Maybe unsafe-to-concat can become opt-in?
The text was updated successfully, but these errors were encountered: