On 1/6/20 11:12 AM, Jan de Mooij wrote:
On Mon, Jan 6, 2020 at 2:51 AM Emilio Cobos Álvarez <emi...@mozilla.com
<mailto:emi...@mozilla.com>> wrote:
If it's not, it could be optimized teaching JSStrings to store UTF-8
instead of / on top of Latin1 or such, or returning more information
from the callee, but I don't know how easy would be the first (IIRC
we're out of JSString bits), and how worth it would be the second.
Feedback here from JS engine hackers would be much appreciated.
Supporting UTF8 JSStrings natively would be quite a lot of work. I added
Latin1 strings a few years ago but Latin1 is a bit simpler than UTF8
because most algorithms could be templatized to work with either char
type. If most of your UTF8 strings are (7-bit) ASCII, it might make
sense short-term to use a Latin1 external string to avoid copies.
Yeah, most of them are ASCII, but it's not easy to track that that the
output is ASCII... It'd still be doable though.
One possible approach would be to treat UTF8 JSStrings somewhat similar
to ropes: initially most places working with JSString characters would
end up converting from UTF8 to Latin1/TwoByte but after that we could
(incrementally) optimize these functions to work with UTF8 strings
directly where possible.
Yeah, I suspect the most common operations that are done on CSS strings
are comparing them, passing them back to the OM, appending to them, and
parse{Int,Float} them (with various variants of split(), substr() and
such involved), so yeah that sounds viable...
Anyhow I need to do some profiling for various cases here to see what
amount of complexity is worth taking for this.
Thanks a lot!
-- Emilio
Jan
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org <mailto:dev-platform@lists.mozilla.org>
https://lists.mozilla.org/listinfo/dev-platform
<https://lists.mozilla.org/listinfo/dev-platform>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform