- From: Emilio Cobos Álvarez <notifications@github.com>
- Date: Wed, 12 Feb 2020 16:38:56 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 13 February 2020 00:39:10 UTC
> How can it know they are dupes without parsing them? Hashmap from text to parsed stylesheet representation effectively. > But I was not aware that exactly-duplicated inline <style> elements would end up with a single backing CSSStyleSheet object in memory. If that's true, then I would say the inline <style> element solution might be a good one here. Gzip will reduce the network overhead, and this stylesheet de-duplication will eliminate the memory overhead. They do: * [Gecko source](https://searchfox.org/mozilla-central/rev/1db5ef59eba65d32d6a29a494e87b6078453e559/layout/style/Loader.cpp#1918) * [WebKit source](https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp?rev=246490#L186) * [Chromium source](https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/css/style_engine.cc;l=758;drc=a7af154233103371fc11baf4e0ede4d1dba5f939) You don't get a pointer-identical `CSSStyleSheet` because that'd be observable, but they share `StyleSheetContents` (curious how all engines ended up choosing the same name for this), which means that they copy-on-write all the CSS rules and such. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/831#issuecomment-585489960
Received on Thursday, 13 February 2020 00:39:10 UTC