RESOLVED FIXED 186696
MediaQuerySet wastes a lot of vector capacity
https://bugs.webkit.org/show_bug.cgi?id=186696
Summary MediaQuerySet wastes a lot of vector capacity
Simon Fraser (smfr)
Reported 2018-06-15 14:43:33 PDT
On theverge.com, we waste about half a meg of vector capacity here: Wasted capacity: 589624 bytes (used 39368 of 628992 bytes, utilization: 6.26%) - 702 allocations 1 0x10743f765 WTF::VectorBuffer<WebCore::MediaQuery, 0ul>::VectorBuffer() 2 0x10743f745 WTF::Vector<WebCore::MediaQuery, 0ul, WTF::CrashOnOverflow, 16ul>::Vector() 3 0x1074284f5 WTF::Vector<WebCore::MediaQuery, 0ul, WTF::CrashOnOverflow, 16ul>::Vector() 4 0x1074284b6 WebCore::MediaQuerySet::MediaQuerySet() 5 0x107428515 WebCore::MediaQuerySet::MediaQuerySet() 6 0x1074283be WebCore::MediaQuerySet::create() 7 0x1075404be WebCore::MediaQueryParser::MediaQueryParser(WebCore::MediaQueryParser::ParserType, WebCore::MediaQueryParserContext) 8 0x10753f534 WebCore::MediaQueryParser::MediaQueryParser(WebCore::MediaQueryParser::ParserType, WebCore::MediaQueryParserContext)
Attachments
Patch (1.36 KB, patch)
2018-06-15 16:26 PDT, Chris Dumez
no flags
Simon Fraser (smfr)
Comment 1 2018-06-15 14:50:50 PDT
Need to re-do the changes from r204006
Radar WebKit Bug Importer
Comment 2 2018-06-15 14:51:23 PDT
Simon Fraser (smfr)
Comment 3 2018-06-15 15:00:28 PDT
Tooling in bug 186698.
Chris Dumez
Comment 4 2018-06-15 16:26:42 PDT
Simon Fraser (smfr)
Comment 5 2018-06-15 16:29:44 PDT
Comment on attachment 342856 [details] Patch Kling's previous changes here did a lot more shrinking: https://trac.webkit.org/changeset/204006. I also wonder if we should shrink MediaQuery's m_expressions vector.
Chris Dumez
Comment 6 2018-06-15 16:30:42 PDT
(In reply to Simon Fraser (smfr) from comment #5) > Comment on attachment 342856 [details] > Patch > > Kling's previous changes here did a lot more shrinking: > https://trac.webkit.org/changeset/204006. I also wonder if we should shrink > MediaQuery's m_expressions vector. The code has not changed and is still there: void MediaQuerySet::shrinkToFit() { m_queries.shrinkToFit(); for (auto& query : m_queries) query.shrinkToFit(); }
Simon Fraser (smfr)
Comment 7 2018-06-15 16:32:44 PDT
Comment on attachment 342856 [details] Patch OK
Chris Dumez
Comment 8 2018-06-15 16:36:40 PDT
(In reply to Chris Dumez from comment #6) > (In reply to Simon Fraser (smfr) from comment #5) > > Comment on attachment 342856 [details] > > Patch > > > > Kling's previous changes here did a lot more shrinking: > > https://trac.webkit.org/changeset/204006. I also wonder if we should shrink > > MediaQuery's m_expressions vector. > > The code has not changed and is still there: > void MediaQuerySet::shrinkToFit() > { > m_queries.shrinkToFit(); > for (auto& query : m_queries) > query.shrinkToFit(); > } I am looking at r204006 but I am not convinced it does more shrinking. We still shrink both the MediaQuerySet and every query in the vector. Also, on ToT, MediaQuerySet::create() is only called in MediaQueryParser, and shrink there after we're done parsing. MediaQuerySet::create(const String&, MediaQueryParserContext&), calls MediaQueryParser::parseMediaQuerySet() which calls MediaQueryParser(MediaQuerySetParser, context).parseInternal(range) where I do the shrinking. I am therefore confident I shrink all MediaQuerySet objects, right after they're parsed.
WebKit Commit Bot
Comment 9 2018-06-15 17:24:13 PDT
Comment on attachment 342856 [details] Patch Clearing flags on attachment: 342856 Committed r232898: <https://trac.webkit.org/changeset/232898>
WebKit Commit Bot
Comment 10 2018-06-15 17:24:15 PDT
All reviewed patches have been landed. Closing bug.
Simon Fraser (smfr)
Comment 11 2018-06-16 16:47:45 PDT
*** Bug 186713 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.