Currently for presentation attributes and CSSOM we convert the base uri to a utf8 string and pass it over to servo. This can be expensive, especially for data: uri documents. We should be doing something better here.
As just discussed on IRC, this is not just expensive at the point when we make the parse call, but makes this sort of SVG (as a data: document, which is not uncommon on the web, unfortunately): <svg> <!-- Define a bunch of paint servers --> <rect fill="url(#foo)"/> <rect fill="url(#bar)"/> <rect fill="url(#foo)"/> <rect fill="url(#bar)"/> </svg> create lots (4 in this case, but in an actual SVG it can easily be hundreds or thousands) of copies of the entire data: URL, for the lifetime of the doc. This is terrible. Gecko handles this by having "#foo" resolved relative to a base data: URI actually share most of the string data, except for the "#foo" bit. So in the above testcase there would still be only one copy of the entire URL in Gecko.
We also shouldn't be constructing the threadsafeuris each time, according to xidorn.
Xidorn, does it make sense to roll this into bug 1310886, or is are the CSSOM/presentational attributes going to need special handling?
IIRC manish's patch somewhere is going to fix bug 1310886 with a less performant way, so we can probably leave the bug open here and fix the performance issue in this bug.
See bug 1343964 comment 2 for xidorn's proposal.
> See bug 1343964 comment 2 for xidorn's proposal. That's this bug...
(In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #5) > See bug 1343964 comment 2 for xidorn's proposal. I think you mean bug 1310886 comment 2.
9 days ago
Another thing to consider here: we're currently using rust-url for this stuff, which is slow. I'm eliminating rust-url usage for specified values in bug 1347435, and we should potentially do the same here.