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

Issue 1132723003: Make GrResourceCache perf less sensitive to key length change (Closed)

Created:
5 years, 7 months ago by Kimmo Kinnunen
Modified:
5 years, 7 months ago
Reviewers:
bsalomon, mtklein
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Make GrResourceCache perf less sensitive to key length change Make GrResourceCache performance less sensitive to key length change. The memcmp in GrResourceKey is called when SkTDynamicHash jumps the slots to find the hash by a index. Avoid most of the memcmps by comparing the hash first. This is important because small changes in key data length can cause big performance regressions. The theory is that key length change causes different hash values. These hash values might trigger memcmps that originally weren't there, causing the regression. Adds few specialized benches to grresourcecache_add to test different key lengths. The tests are run only on release, because on debug the SkTDynamicHash validation takes too long, and adding many such delays to development test runs would be unproductive. On release the tests are quite fast. Effect of this patch to the added tests on amd64: grresourcecache_find_10 738us -> 768us 1.04x grresourcecache_find_2 472us -> 476us 1.01x grresourcecache_find_25 841us -> 845us 1x grresourcecache_find_4 565us -> 531us 0.94x grresourcecache_find_54 1.18ms -> 1.1ms 0.93x grresourcecache_find_5 834us -> 749us 0.9x grresourcecache_find_3 620us -> 542us 0.87x grresourcecache_add_25 2.74ms -> 2.24ms 0.82x grresourcecache_add_56 3.23ms -> 2.56ms 0.79x grresourcecache_add_54 3.34ms -> 2.62ms 0.78x grresourcecache_add_5 2.68ms -> 2.1ms 0.78x grresourcecache_add_10 2.7ms -> 2.11ms 0.78x grresourcecache_add_2 1.85ms -> 1.41ms 0.76x grresourcecache_add 1.84ms -> 1.4ms 0.76x grresourcecache_add_4 1.99ms -> 1.49ms 0.75x grresourcecache_add_3 2.11ms -> 1.55ms 0.73x grresourcecache_add_55 39ms -> 13.9ms 0.36x grresourcecache_find_55 23.2ms -> 6.21ms 0.27x On arm64 the results are similar. On arm_v7_neon, the results lack the discontinuity at 55: grresourcecache_add 4.06ms -> 4.26ms 1.05x grresourcecache_add_2 4.05ms -> 4.23ms 1.05x grresourcecache_find 1.28ms -> 1.3ms 1.02x grresourcecache_find_56 3.35ms -> 3.32ms 0.99x grresourcecache_find_2 1.31ms -> 1.29ms 0.99x grresourcecache_find_54 3.28ms -> 3.24ms 0.99x grresourcecache_add_5 6.38ms -> 6.26ms 0.98x grresourcecache_add_55 8.44ms -> 8.24ms 0.98x grresourcecache_add_25 7.03ms -> 6.86ms 0.98x grresourcecache_find_25 2.7ms -> 2.59ms 0.96x grresourcecache_find_4 1.45ms -> 1.38ms 0.95x grresourcecache_find_10 2.52ms -> 2.39ms 0.95x grresourcecache_find_55 3.54ms -> 3.33ms 0.94x grresourcecache_find_5 2.5ms -> 2.32ms 0.93x grresourcecache_find_3 1.57ms -> 1.43ms 0.91x The extremely slow case, 55, is postulated to be due to the index jump collisions running the memcmp. This is not visible on arm_v7_neon probably due to hash function producing different results for 32 bit architectures. This change is needed for extending path cache key in Gr NV_path_rendering codepath. Extending is needed in order to add dashed paths to the path cache. Committed: https://skia.googlesource.com/skia/+/54b8511189bb5da6bfd248fa63f5c4156e9e2bd6

Patch Set 1 #

Patch Set 2 : #

Total comments: 1

Patch Set 3 : Remove an unused variable in the test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -16 lines) Patch
M bench/GrResourceCacheBench.cpp View 1 2 6 chunks +58 lines, -15 lines 0 comments Download
M include/gpu/GrResourceKey.h View 1 2 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 25 (6 generated)
Kimmo Kinnunen
5 years, 7 months ago (2015-05-15 11:57:41 UTC) #2
mtklein
This seems like a good idea to me. In most of these hash table use ...
5 years, 7 months ago (2015-05-15 12:38:49 UTC) #4
mtklein
This seems like a good idea to me. In most of these hash table use ...
5 years, 7 months ago (2015-05-15 12:38:50 UTC) #5
mtklein
https://codereview.chromium.org/1132723003/diff/20001/bench/GrResourceCacheBench.cpp File bench/GrResourceCacheBench.cpp (right): https://codereview.chromium.org/1132723003/diff/20001/bench/GrResourceCacheBench.cpp#newcode165 bench/GrResourceCacheBench.cpp:165: // Only on release because on debug the SkTDynamicHash ...
5 years, 7 months ago (2015-05-15 12:43:06 UTC) #6
Kimmo Kinnunen
On 2015/05/15 12:38:50, mtklein wrote: > This seems like a good idea to me. > ...
5 years, 7 months ago (2015-05-15 13:08:39 UTC) #7
bsalomon
On 2015/05/15 13:08:39, Kimmo Kinnunen wrote: > On 2015/05/15 12:38:50, mtklein wrote: > > This ...
5 years, 7 months ago (2015-05-15 13:58:23 UTC) #8
mtklein
On 2015/05/15 13:58:23, bsalomon wrote: > On 2015/05/15 13:08:39, Kimmo Kinnunen wrote: > > On ...
5 years, 7 months ago (2015-05-15 14:00:59 UTC) #9
mtklein
On 2015/05/15 14:00:59, mtklein wrote: > On 2015/05/15 13:58:23, bsalomon wrote: > > On 2015/05/15 ...
5 years, 7 months ago (2015-05-15 14:03:42 UTC) #10
bsalomon
On 2015/05/15 14:00:59, mtklein wrote: > On 2015/05/15 13:58:23, bsalomon wrote: > > On 2015/05/15 ...
5 years, 7 months ago (2015-05-15 14:04:34 UTC) #11
mtklein
On 2015/05/15 14:04:34, bsalomon wrote: > On 2015/05/15 14:00:59, mtklein wrote: > > On 2015/05/15 ...
5 years, 7 months ago (2015-05-15 14:06:43 UTC) #12
Kimmo Kinnunen
On 2015/05/15 14:00:59, mtklein wrote: > On 2015/05/15 13:58:23, bsalomon wrote: > > On 2015/05/15 ...
5 years, 7 months ago (2015-05-18 05:51:28 UTC) #13
Kimmo Kinnunen
On 2015/05/15 14:03:42, mtklein wrote: > It looks like GrResourceKeyHash() is using SkChecksum::Compute(), which is ...
5 years, 7 months ago (2015-05-18 08:54:35 UTC) #14
Kimmo Kinnunen
On 2015/05/18 05:51:28, Kimmo Kinnunen wrote: > Hash function could be better, maybe. It does ...
5 years, 7 months ago (2015-05-18 11:28:49 UTC) #15
bsalomon
Kimmo, I didn't mean to hold up this patch while we look at further enhancements ...
5 years, 7 months ago (2015-05-18 13:17:35 UTC) #16
Kimmo Kinnunen
On 2015/05/18 13:17:35, bsalomon wrote: > Also, the resource limit in the cache is somewhat ...
5 years, 7 months ago (2015-05-18 13:26:22 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1132723003/20001
5 years, 7 months ago (2015-05-19 05:18:31 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: Build-Ubuntu-Clang-x86_64-Debug-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu-Clang-x86_64-Debug-Trybot/builds/1144)
5 years, 7 months ago (2015-05-19 05:21:54 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1132723003/40001
5 years, 7 months ago (2015-05-19 05:41:46 UTC) #24
commit-bot: I haz the power
5 years, 7 months ago (2015-05-19 05:47:39 UTC) #25
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://skia.googlesource.com/skia/+/54b8511189bb5da6bfd248fa63f5c4156e9e2bd6

Powered by Google App Engine
This is Rietveld 408576698