You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CA-361221: utf8_recode: use Uutf.{Buffer.add_utf_8,String.fold_utf_8} instead of Uutf.{encode,decoder}
Uutf.encoder allocates a 64k buffer internally (in addition to our 1k buffer).
Use Uutf.Buffer to write utf8 chars directly into our buffer instead.
Also size the buffer based on initial string size (it can grow if needed).
This should reduce allocation rate.
Thanks to a hint from https://discuss.ocaml.org/t/decoding-many-unicode-strings-with-uutf/8910/2
Also avoid allocations if string is all utf8
This could be further optimized to stop on first invalid utf8 char and
do the recode on the rest.
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
0 commit comments