• commit-bot@chromium.org's avatar
    Convert SkWriter32 to use an SkTDArray for its internal storage. · 19382421
    commit-bot@chromium.org authored
    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
    19382421
WriterBench.cpp 1.02 KB