Bug 126077 - Rewrite Text node attaching to not be N^2 in HTML parser
Summary: Rewrite Text node attaching to not be N^2 in HTML parser
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BlinkMergeCandidate
Depends on:
Blocks:
 
Reported: 2013-12-20 11:38 PST by Ryosuke Niwa
Modified: 2023-09-26 18:55 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2013-12-20 11:38:11 PST
Consider merging https://chromium.googlesource.com/chromium/blink/+/4a1cb7c3ac3015f577bb04fe60dac68df478e70b

Previously Text node creation used String::append which was N^2.
Now instead we use StringBuilder, batch up all the text from
the network and then split it into Text nodes if necessary
all at once.

This should be a perf win for pages with large text nodes
and slow networks.
Comment 1 Brent Fulgham 2016-01-11 11:36:36 PST
Was this ever evaluated? Can we close this bug if we don't think this is relevant or useful for us?
Comment 2 Ryosuke Niwa 2016-01-11 13:28:04 PST
Antti, didn't you fix this?
Comment 3 Antti Koivisto 2016-01-12 06:03:21 PST
No, I haven't done anything with text nodes. The blink commit doesn't indicate if this was an observed problem rather than a theoretical one. As far as I see this isn't an actual O(n^2) because we limit the text node length to 64k characters and split them up as needed.
Comment 4 Ahmad Saleem 2023-09-26 18:55:36 PDT
@Chris - something needed?