Closed Bug 1682003 Opened 5 years ago Closed 5 years ago

Use UTF8String for CSSOM serialization.

Categories

(Core :: DOM: CSS Object Model, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(2 files)

I have a hack on top of bug 1681939 which shaves around 100/200ms from the following test-case:

<!DOCTYPE html>
<style>
</style>
<script>
  var div = document.createElement("div");
  var s = div.style;
  s.top = "10px";
  var count = 10000000;
  var start = new Date;
  for (var i = 0; i < count; ++i) {
    var x = s.top;
  }
  var stop = new Date;
  document.write(stop - start);
  </script>
Flags: needinfo?(emilio)
Severity: -- → N/A
Type: defect → enhancement
Priority: -- → P2
Depends on: 1682120
Depends on: 1682121

This lifts a bunch of string conversions higher up the stack, but allows
us to make the servo code use utf-8 unconditionally, and seemed faster
in my benchmarking (see comment 0).

It should also make a bunch of attribute setters faster too (like
setting .cssText), now that we use UTF8String for them (we couldn't
because we couldn't specify different string types for the getter and
setters).

Flags: needinfo?(emilio)
Attached file testcase
Blocks: 1682988
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b2cf325325e1 Avoid UTF-8 -> UTF-16 conversion during CSSOM serialization. r=heycam
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Regressions: 1683336
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: