Closed Bug 263959 Opened 20 years ago Closed 20 years ago

[FIX]Reuse CSS scanners, not just CSS parsers

Categories

(Core :: CSS Parsing and Computation, defect, P2)

x86
All
defect

Tracking

()

RESOLVED FIXED
mozilla1.8alpha5

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

()

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

This comes from the profile in bug 229391. In that profile, we're spending a good bit of time (comparable to total time spent in painting, basically) in InitScanner() and ReleaseScanner(), because we have thousands of inline style rules being set in a row. The patch coming up makes CSS parsers not actually delete the scanner when they ReleaseScanner() and makes scanners deal with being reinitialized. It saves us about 1% of the total time on the testcase in the URL field.
Attached patch Patch (obsolete) (deleted) — Splinter Review
Attachment #161824 - Flags: superreview?(dbaron)
Attachment #161824 - Flags: review?(dbaron)
Keywords: perf
Priority: -- → P2
Summary: Reuse CSS scanners, not just CSS parsers → [FIX]Reuse CSS scanners, not just CSS parsers
Target Milestone: --- → mozilla1.8alpha5
Note to self: the line in nsCSSScanner.h that declares mURI is now: nsCOMPtr<nsIURI> mURI; // Cached so we know to not refetch mFileName per grammar nit on irc.
Blocks: 229391
Comment on attachment 161824 [details] [diff] [review] Patch I'm not convinced ClearScanningState deserves to be its own function. It doesn't really clear all the state, so it doesn't seem useful to callers other than Init, and there is only one caller. Also, is there any reason CSSParserImpl::mScanner needs to be a pointer?
Attachment #161824 - Flags: superreview?(dbaron)
Attachment #161824 - Flags: superreview+
Attachment #161824 - Flags: review?(dbaron)
Attachment #161824 - Flags: review+
Attachment #161824 - Attachment is obsolete: true
Fixed
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
So, maybe I'm missing something, but it looks like you're never setting mScannerInited to true.
Good catch. Checked in the fix.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: