mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Change CData._data from []const to String (SSO)
After looking at a handful of websites, the # of Text and Commend nodes that are small (<= 12 bytes) is _really_ high. Ranging from 85% to 98%. I thought that was high, but a lot of it is indentation or a sentence that's broken down into multiple nodes, eg: <div><b>sale!</b> <span class=price>$1.99</span> buy now<div> So what looks like 1 sentence to us, is actually 3 text nodes. On a typical website, we should see thousands of fewer allocations in the page arena for the text in text nodes.
This commit is contained in:
@@ -307,7 +307,11 @@ pub const Writer = struct {
|
||||
try w.write(dom_node.getNodeName(&name_buf));
|
||||
|
||||
try w.objectField("nodeValue");
|
||||
try w.write(dom_node.getNodeValue() orelse "");
|
||||
if (dom_node.getNodeValue()) |nv| {
|
||||
try w.write(nv.str());
|
||||
} else {
|
||||
try w.write("");
|
||||
}
|
||||
|
||||
if (include_child_count) {
|
||||
try w.objectField("childNodeCount");
|
||||
|
||||
Reference in New Issue
Block a user