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

Issue 7077006: Speed up IdAllocator. (Closed)

Created:
9 years, 7 months ago by lain Merrick
Modified:
9 years, 7 months ago
Reviewers:
greggman, M-A Ruel
CC:
chromium-reviews, apatrick_chromium
Visibility:
Public.

Description

Speed up IdAllocator. I noticed while debugging that FindFirstFree() was iterating through all existing IDs, so it's O(n^2). This CL makes most operations constant time by adding an explicit freelist (but we need to fall back to a linear search in the worst case). This will increase memory usage slightly, but only by as much as the maximum number of IDs that were in use at any one time. We won't get "garbage IDs" building up over time. MarkAsUsed and FreeID both do an erase/insert pair. The erase could be optimised out (as we've already done the lookup by this point) but I figured it was clearer and simpler this way. TEST=Existing Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=87026

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : Clarified description. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+61 lines, -8 lines) Patch
M gpu/command_buffer/common/id_allocator.h View 1 1 chunk +6 lines, -1 line 1 comment Download
M gpu/command_buffer/common/id_allocator.cc View 1 1 chunk +40 lines, -7 lines 0 comments Download
M gpu/command_buffer/common/id_allocator_test.cc View 1 2 chunks +15 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
lain Merrick
9 years, 7 months ago (2011-05-26 14:47:46 UTC) #1
greggman
Just curious but did this actually show up on a profile? It seems like you'd ...
9 years, 7 months ago (2011-05-26 16:25:29 UTC) #2
lain Merrick
On 2011/05/26 16:25:29, greggman wrote: > Just curious but did this actually show up on ...
9 years, 7 months ago (2011-05-26 16:35:12 UTC) #3
lain Merrick
On 2011/05/26 16:35:12, Iain Merrick wrote: > Hmm, I guess I could try that. Going ...
9 years, 7 months ago (2011-05-26 16:37:55 UTC) #4
greggman
Ok, well, LGTM. We can do the hash_set thing later I guess.
9 years, 7 months ago (2011-05-26 17:07:19 UTC) #5
lain Merrick
On 2011/05/26 17:07:19, greggman wrote: > Ok, well, LGTM. We can do the hash_set thing ...
9 years, 7 months ago (2011-05-26 17:08:44 UTC) #6
M-A Ruel
When you send try jobs with this change, it kills the try slaves, even with ...
9 years, 7 months ago (2011-05-26 18:06:46 UTC) #7
lain Merrick
On 2011/05/26 18:06:46, Marc-Antoine Ruel wrote: > When you send try jobs with this change, ...
9 years, 7 months ago (2011-05-26 18:07:32 UTC) #8
M-A Ruel
Ignore this, it's unrelated to your change. Something else is breaking the slaves.
9 years, 7 months ago (2011-05-26 18:22:31 UTC) #9
lain Merrick
9 years, 7 months ago (2011-05-27 15:45:12 UTC) #10
Having done some profiling, with an admittedly artificial test involving lots of
texture churn, FindFirstFree is indeed a hotspot in this class. I's pretty
insignificant in the grand scheme of things, but I'll go ahead and submit. Now
that I've got profiling set up I can look for some bigger targets.

Powered by Google App Engine
This is Rietveld 408576698