Bug 16780

Summary: CSSSelector doesn't use subclassing, contains fields for all types of selectors
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: CSSAssignee: 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)
Reported 2008-01-07 21:14:36 PST
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
Maciej Stachowiak
Comment 1 2008-01-07 21:17:08 PST
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)
Comment 2 2008-01-07 21:26:38 PST
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
Comment 3 2008-01-07 21:27:27 PST
I meant CSSSelector. Damn those confusingly similar names!
Dave Hyatt
Comment 4 2008-01-08 11:57:42 PST
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
Comment 5 2014-11-01 16:22:56 PDT
Closing: CSSSelector takes very little memory.
Note You need to log in before you can comment on or make changes to this bug.