Bug 123995 - [CSS Grid Layout] Cache several vectors to avoid malloc/free churn
Summary: [CSS Grid Layout] Cache several vectors to avoid malloc/free churn
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sergio Villar Senin
URL:
Keywords:
Depends on: 124408
Blocks: 123989 123994
  Show dependency treegraph
 
Reported: 2013-11-07 08:10 PST by Sergio Villar Senin
Modified: 2013-11-25 00:19 PST (History)
8 users (show)

See Also:


Attachments
Patch (21.09 KB, patch)
2013-11-22 03:19 PST, Sergio Villar Senin
dino: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Villar Senin 2013-11-07 08:10:46 PST
We should probably merge:

    Cache several vectors to avoid malloc/free churn
    
    distributeSpaceToTracks and
    resolveContentBasedTrackSizingFunctionsForItems are both
    called in a loop during layout and resulted in a lot of
    mallocs / frees calls. This change just keeps their Vectors
    around until the end of Layout, keeping the memory around.
    
    This is a classic runtime vs memory trade-off as we will hold
    onto the biggest allocation until the end of layout, which
    should be fine as we *have* to allocate that amount.
    
    This code refactors the often passed-in arguments & the cached
    Vectors into a new data structure GridSizingData. This makes
    the code cleaner while making it difficult to forget free'ing
    the memory at the end of layout.
    
    This is a 40% improvement on auto-grid-lots-of-data.html.
    
    BUG=273238
    
    Review URL: https://chromiumcodereview.appspot.com/24331003
Comment 1 Sergio Villar Senin 2013-11-18 08:42:59 PST
I have a patch ready for this, but I won't upload it as it depends in another two patches already pending on review.
Comment 2 Sergio Villar Senin 2013-11-22 03:19:40 PST
Created attachment 217664 [details]
Patch
Comment 3 Dean Jackson 2013-11-22 10:46:56 PST
Comment on attachment 217664 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=217664&action=review

> Source/WebCore/ChangeLog:10
> +        Layouting the grid items means a lot of calls to

Laying-out
Comment 4 Sergio Villar Senin 2013-11-25 00:19:45 PST
Committed r159741: <http://trac.webkit.org/changeset/159741>