skia2/bench
kkinnunen 54b8511189 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.

Review URL: https://codereview.chromium.org/1132723003
2015-05-18 22:47:33 -07:00
..
AAClipBench.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
AlternatingColorPatternBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
bench_compare.py Make bench_compare executable. 2013-11-12 15:25:31 +00:00
bench_util.py Restore bench_util.py 2014-08-08 17:28:53 -04:00
BenchLogger.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
BenchLogger.h Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
Benchmark.cpp SkPaint::FilterLevel -> SkFilterQuality 2015-03-16 10:08:34 -07:00
Benchmark.h Add _aa variants of Xfermode benches. 2015-05-13 11:54:00 -07:00
BezierBench.cpp Draw more accurate thick-stroked Beziers (disabled) 2014-10-09 05:36:04 -07:00
BigPathBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
BigPathBench.inc add bench for very big paths 2015-02-06 13:04:16 -08:00
BitmapBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
BitmapRectBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
BitmapScaleBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
BlurBench.cpp 2D kernel initial wiring for Guassian 2014-08-11 13:55:34 -07:00
BlurImageFilterBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
BlurRectBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
BlurRectsBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
BlurRoundRectBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ChartBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
check_bench_regressions.py Adds dashboard link for one-line plot on each alert item. 2014-05-13 17:38:17 +00:00
ChecksumBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ChromeBench.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
CmapBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
CodecBench.cpp Test SkCodec to kIndex8 in nanobench. 2015-04-02 13:22:38 -07:00
CodecBench.h Test SkCodec to kIndex8 in nanobench. 2015-04-02 13:22:38 -07:00
ColorCubeBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ColorFilterBench.cpp remove useless benches 2015-04-02 20:31:17 -07:00
ColorPrivBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ControlBench.cpp Add a control benchmark. 2015-05-06 12:42:04 -07:00
CoverageBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
DashBench.cpp Add matrix constructing helpers to SkMatrix 2015-03-26 19:57:08 -07:00
DecodingBench.cpp Test SkCodec to kIndex8 in nanobench. 2015-04-02 13:22:38 -07:00
DecodingBench.h Test SkCodec to kIndex8 in nanobench. 2015-04-02 13:22:38 -07:00
DecodingSubsetBench.cpp Adding new benchmark to test image decoding performance. 2015-02-13 09:05:42 -08:00
DecodingSubsetBench.h C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
DeferredSurfaceCopyBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
DisplacementBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ETCBitmapBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
FontCacheBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
FontScalerBench.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
FSRectBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
GameBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
gen_bench_expectations.py Added in framework to get more bench data 2014-06-12 11:27:40 -07:00
GeometryBench.cpp remove slower scalar code in favor of vectors 2015-03-26 07:26:08 -07:00
GMBench.cpp remove unused GM flags 2015-01-23 11:07:08 -08:00
GMBench.h C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
GradientBench.cpp Revert of Revert of stop calling SkScalarDiv (patchset #1 id:1 of https://codereview.chromium.org/1138263002/) 2015-05-12 10:37:34 -07:00
GrMemoryPoolBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
GrOrderedSetBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
GrResourceCacheBench.cpp Make GrResourceCache perf less sensitive to key length change 2015-05-18 22:47:33 -07:00
gUniqueGlyphIDs.h switch array to uint16_t to fix overflows 2013-06-11 19:53:19 +00:00
HairlinePathBench.cpp crank up innerloop to make hairlinebench more usable/reliable 2015-04-13 11:12:06 -07:00
ImageCacheBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ImageFilterCollapse.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ImageFilterDAGBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
InterpBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
LightingBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
LineBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
MagnifierBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
MathBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
Matrix44Bench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
MatrixBench.cpp use Sk4f for matrix math 2015-03-29 11:58:48 -07:00
MatrixConvolutionBench.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
MemcpyBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
MemoryBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
MemsetBench.cpp Rewrite memset benches, then use results to add a small-N optimization. 2015-04-09 14:05:17 -07:00
MergeBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
microbench.json Fix the other microbench schema 2014-07-25 08:30:11 -07:00
MipMapBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
MorphologyBench.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
MutexBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
nanobench.cpp DM+nanobench: print both current and max RSS. 2015-04-30 07:11:22 -07:00
nanobench.h Minor cleanup in nanobench 2015-03-27 12:11:44 -07:00
nanobenchAndroid.cpp Move HWUI boilerplate into utils/android 2015-03-27 12:22:01 -07:00
nanobenchAndroid.h Move HWUI boilerplate into utils/android 2015-03-27 12:22:01 -07:00
PatchBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
PatchGridBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
PathBench.cpp Add matrix constructing helpers to SkMatrix 2015-03-26 19:57:08 -07:00
PathIterBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
PerlinNoiseBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
PictureNestingBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
PictureOverheadBench.cpp Expand bench to cover no-draw SkPictures too. 2015-04-06 07:25:04 -07:00
PicturePlaybackBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
PMFloatBench.cpp New names for SkPMFloat methods. 2015-04-03 07:05:20 -07:00
PremulAndUnpremulAlphaOpsBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ReadPixBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RecordingBench.cpp add some debugging to SkNVRefCnt 2014-11-24 12:02:31 -08:00
RecordingBench.h C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RectanizerBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RectBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RectoriBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RefCntBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RegionBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RegionContainBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RepeatTileBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ResultsWriter.h Upload picture byte size and op count metrics for SKP recording. 2014-12-04 08:46:51 -08:00
RotatedRectBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
RTreeBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ScalarBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
ShaderMaskBench.cpp Cleanup: Remove a bunch of SkFontHost.h includes (unused). 2014-12-18 05:48:53 -08:00
SkipZeroesBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
SKPAnimationBench.cpp Change to add zoom animations to nanobench 2015-04-27 09:16:57 -07:00
SKPAnimationBench.h Change to add zoom animations to nanobench 2015-04-27 09:16:57 -07:00
SKPBench.cpp Change to add zoom animations to nanobench 2015-04-27 09:16:57 -07:00
SKPBench.h Change to add zoom animations to nanobench 2015-04-27 09:16:57 -07:00
skpbench.json Fix scale type in JSON format 2014-06-26 15:39:31 -07:00
SortBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
StrokeBench.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
TableBench.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
TextBench.cpp Move resource fonts to common location. 2015-04-30 17:12:58 -04:00
TextBlobBench.cpp BUG=skia: 2015-04-03 08:07:26 -07:00
tile_analyze.py Script to plot tile vs. viewport comparison for given platform and revision. 2013-02-13 23:22:29 +00:00
TileBench.cpp SkPaint::FilterLevel -> SkFilterQuality 2015-03-16 10:08:34 -07:00
VertBench.cpp Remove Sk prefix from some bench classes. 2014-06-19 12:32:29 -07:00
WritePixelsBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
WriterBench.cpp C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} 2015-03-25 18:17:32 -07:00
XfermodeBench.cpp Add _aa variants of Xfermode benches. 2015-05-13 11:54:00 -07:00