From 19382421b916aab00be7265815ba4e2690adf2c9 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Tue, 14 Jan 2014 20:51:26 +0000 Subject: 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 R=reed@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/137433003 git-svn-id: http://skia.googlecode.com/svn/trunk@13073 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkPaint.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/core/SkPaint.cpp') diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 94ffa8d31b..af032d001e 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -1815,9 +1815,7 @@ void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties, SkMaskFilter* mf = this->getMaskFilter(); SkRasterizer* ra = this->getRasterizer(); - SkOrderedWriteBuffer peBuffer(MIN_SIZE_FOR_EFFECT_BUFFER); - SkOrderedWriteBuffer mfBuffer(MIN_SIZE_FOR_EFFECT_BUFFER); - SkOrderedWriteBuffer raBuffer(MIN_SIZE_FOR_EFFECT_BUFFER); + SkOrderedWriteBuffer peBuffer, mfBuffer, raBuffer; if (pe) { peBuffer.writeFlattenable(pe); @@ -1845,7 +1843,7 @@ void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties, } #ifdef SK_BUILD_FOR_ANDROID - SkOrderedWriteBuffer androidBuffer(128); + SkOrderedWriteBuffer androidBuffer; fPaintOptionsAndroid.flatten(androidBuffer); descSize += androidBuffer.size(); entryCount += 1; -- cgit v1.2.3