The default bug view has changed. See this FAQ.

stylo: Figure out a performant solution for base URIs

Assigned to



CSS Parsing and Computation
20 days ago
20 hours ago


(Reporter: manishearth, Assigned: xidorn)


(Blocks: 3 bugs)

Firefox Tracking Flags

(Not tracked)




20 days ago
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):

   <!-- Define a bunch of paint servers -->
   <rect fill="url(#foo)"/>
   <rect fill="url(#bar)"/>
   <rect fill="url(#foo)"/>
   <rect fill="url(#bar)"/>

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.

Comment 2

15 days ago
We also shouldn't be constructing the threadsafeuris each time, according to xidorn.
Assignee: nobody → xidorn+moz
Priority: -- → P1
Xidorn, does it make sense to roll this into bug 1310886, or is are the CSSOM/presentational attributes going to need special handling?
Flags: needinfo?(xidorn+moz)

Comment 4

13 days ago
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.
Flags: needinfo?(xidorn+moz)
See bug 1343964 comment 2 for xidorn's proposal.
Summary: stylo: Figure out a solution for base URIs → stylo: Figure out a performant solution for base URIs
> See bug 1343964 comment 2 for xidorn's proposal.

That's this bug...

Comment 7

13 days ago
(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.
Blocks: 1346974
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.
Blocks: 1349438
You need to log in before you can comment on or make changes to this bug.