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

Issue 137433003: Convert SkWriter32 to use an SkTDArray for its internal storage. (Closed)

Created:
6 years, 11 months ago by mtklein
Modified:
6 years, 11 months ago
Reviewers:
reed1
CC:
skia-review_googlegroups.com, tomhudson, fmalita_google_do_not_use
Base URL:
https://skia.googlesource.com/skia.git@master
Visibility:
Public.

Description

Convert SkWriter32 to use an SkTDArray for its internal storage. This reduces the allocation overhead of a null picture (create, beginRecording(), endRecording) from about 18K to about 1.9K. (There's still lots more to prune.) SkPictureFlat can exploit the fact that Writer32 is contiguous simplify its memory management. The Writer32 itself becomes the scratch buffer. Remove lots and lots of arbitrary magic numbers that were size guesses and minimum allocation sizes. Keep your eyes open for the big obvious DUH why we save 16K per picture! (Spoiler alert. It's because that first save we issue in beginRecording() forces the old SkWriter32 to allocate 16K.) Tests passing, DM passing. bench --match writer: ~20% faster null bench_record: ~30% faster bench_record on buildbot .skps: ~3-6% slower, ranging 25% faster to 20% slower bench_pictures on buildbot .skps: ~1-2% faster, ranging 13% faster to 28% slower BUG=skia:1850 Committed: http://code.google.com/p/skia/source/detail?r=13073

Patch Set 1 #

Patch Set 2 : DM ok now. #

Patch Set 3 : Related cleanup. #

Patch Set 4 : simplify readFromStream #

Patch Set 5 : get rid of unused guesses #

Patch Set 6 : add begin and detach and update tests #

Patch Set 7 : tweak comment #

Patch Set 8 : remove detach for now #

Patch Set 9 : comments and tweaks #

Patch Set 10 : remove SizeWithPadding #

Patch Set 11 : update android-guarded write buffers #

Total comments: 3

Patch Set 12 : make reservePad less cryptic #

Patch Set 13 : of course 0's fine too... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+211 lines, -524 lines) Patch
M bench/WriterBench.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M include/core/SkWriter32.h View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +109 lines, -136 lines 0 comments Download
M src/core/SkFlattenableSerialization.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/core/SkOrderedWriteBuffer.h View 1 2 3 4 5 1 chunk +5 lines, -7 lines 0 comments Download
M src/core/SkOrderedWriteBuffer.cpp View 1 2 1 chunk +3 lines, -4 lines 0 comments Download
M src/core/SkPaint.cpp View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -4 lines 0 comments Download
M src/core/SkPictureFlat.h View 1 2 3 4 5 6 7 8 9 9 chunks +26 lines, -64 lines 0 comments Download
M src/core/SkPicturePlayback.cpp View 1 2 6 7 1 chunk +1 line, -2 lines 0 comments Download
M src/core/SkPictureRecord.cpp View 1 2 2 chunks +0 lines, -2 lines 0 comments Download
M src/core/SkScalerContext.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M src/core/SkWriter32.cpp View 1 2 3 2 chunks +2 lines, -232 lines 0 comments Download
M src/pipe/SkGPipeWrite.cpp View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M src/utils/SkCanvasStateUtils.cpp View 1 2 2 chunks +2 lines, -6 lines 0 comments Download
M tests/AndroidPaintTest.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M tests/ColorFilterTest.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M tests/PathTest.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M tests/SerializationTest.cpp View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M tests/Writer32Test.cpp View 1 2 3 4 5 6 7 5 chunks +50 lines, -56 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
mtklein
6 years, 11 months ago (2014-01-14 18:37:48 UTC) #1
reed1
lgtm https://codereview.chromium.org/137433003/diff/210001/include/core/SkWriter32.h File include/core/SkWriter32.h (right): https://codereview.chromium.org/137433003/diff/210001/include/core/SkWriter32.h#newcode185 include/core/SkWriter32.h:185: case 1: *tail++ = 0x00; will we get ...
6 years, 11 months ago (2014-01-14 18:59:37 UTC) #2
mtklein
https://codereview.chromium.org/137433003/diff/210001/include/core/SkWriter32.h File include/core/SkWriter32.h (right): https://codereview.chromium.org/137433003/diff/210001/include/core/SkWriter32.h#newcode185 include/core/SkWriter32.h:185: case 1: *tail++ = 0x00; On 2014/01/14 18:59:37, reed1 ...
6 years, 11 months ago (2014-01-14 19:52:02 UTC) #3
mtklein
https://codereview.chromium.org/137433003/diff/210001/include/core/SkWriter32.h File include/core/SkWriter32.h (right): https://codereview.chromium.org/137433003/diff/210001/include/core/SkWriter32.h#newcode185 include/core/SkWriter32.h:185: case 1: *tail++ = 0x00; On 2014/01/14 19:52:02, mtklein ...
6 years, 11 months ago (2014-01-14 20:38:16 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/mtklein@google.com/137433003/330001
6 years, 11 months ago (2014-01-14 20:38:37 UTC) #5
commit-bot: I haz the power
6 years, 11 months ago (2014-01-14 20:51:34 UTC) #6
Message was sent while issue was closed.
Change committed as 13073

Powered by Google App Engine
This is Rietveld 408576698