Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Issue 24331003: Cache several vectors to avoid malloc/free churn (Closed)

Created:
7 years, 3 months ago by Julien - ping for review
Modified:
7 years, 3 months ago
Reviewers:
esprehn, Z_DONOTUSE, ojan
CC:
blink-reviews, eae+blinkwatch, leviw+renderwatch, jchaffraix+rendering
Visibility:
Public.

Description

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 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=158228

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+72 lines, -54 lines) Patch
M Source/core/rendering/RenderGrid.h View 4 chunks +7 lines, -6 lines 0 comments Download
M Source/core/rendering/RenderGrid.cpp View 13 chunks +65 lines, -48 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Julien - ping for review
7 years, 3 months ago (2013-09-23 16:17:44 UTC) #1
Z_DONOTUSE
lgtm
7 years, 3 months ago (2013-09-23 23:49:21 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jchaffraix@chromium.org/24331003/1
7 years, 3 months ago (2013-09-23 23:51:11 UTC) #3
commit-bot: I haz the power
7 years, 3 months ago (2013-09-24 01:25:22 UTC) #4
Message was sent while issue was closed.
Change committed as 158228

Powered by Google App Engine
This is Rietveld 408576698