Bug 16780
Summary: | CSSSelector doesn't use subclassing, contains fields for all types of selectors | ||
---|---|---|---|
Product: | WebKit | Reporter: | Eric Seidel (no email) <eric> |
Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | benjamin, hyatt |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Mac | ||
OS: | OS X 10.4 |
Eric Seidel (no email)
CSSSelector is a memory hog
Wow. We don't have any subclasses of CSSSelector? Makes little sense to me. It seems that breaking things like "QualifiedName attr" off into a less-used CSSSelector subclass could be a Very Large⢠memory savings for WebCore, given how large modern CSS files can be. This could be a win for mobile devices which have tighter memory constraints.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Maciej Stachowiak
I don't think CSSStyleSelector creates that much memory use in practice, so I'm not sure this would have a huge memory impact. But using subclasses may result in cleaner code. Hard to say.
Eric Seidel (no email)
I'm confused as to if you mean CSSStyleSelector or CSSSelector in your comment. I mean the latter. CSSStyleSelector contributes very little to memory usage (there is only one per doc). There is one CSSSelector object per selector in a CSS document. I've not tested to confirm the memory usage, but it's certainly non-zero.
Maciej Stachowiak
I meant CSSSelector. Damn those confusingly similar names!
Dave Hyatt
Yeah, this could be optimized some. It's never been that big a deal, since there just aren't that many selectors per document. In general the stylesheets themselves don't take up that much memory relative to other things.
Benjamin Poulain
Closing: CSSSelector takes very little memory.