aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRecord.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-04-08 14:02:31 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-08 14:02:32 -0700
commite2dd9408cd711777afaa9410427fb0d761ab004a (patch)
tree826b146386e80c85416b72e541d38b9410dc0777 /src/core/SkRecord.cpp
parent16e833d5aac6570e134cf8e5356df635e01e092e (diff)
Rearrange SkRecord with small N in mind
This rearranges the record pointers and types so they can go in a single array, then preallocates some space for them and for the SkVarAlloc. picture_overhead_draw bench drops from ~1000ns to 500-600ns, with no effect on picture_overhead_nodraw. I don't see any significant effect on large picture recording times from our .skps. BUG=chromium:470553 Review URL: https://codereview.chromium.org/1061783002
Diffstat (limited to 'src/core/SkRecord.cpp')
-rw-r--r--src/core/SkRecord.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/SkRecord.cpp b/src/core/SkRecord.cpp
index e2d919b777..c2008a850a 100644
--- a/src/core/SkRecord.cpp
+++ b/src/core/SkRecord.cpp
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#include "SkRecord.h"
SkRecord::~SkRecord() {
@@ -9,13 +16,13 @@ SkRecord::~SkRecord() {
void SkRecord::grow() {
SkASSERT(fCount == fReserved);
- fReserved = SkTMax<unsigned>(kFirstReserveCount, fReserved*2);
+ SkASSERT(fReserved > 0);
+ fReserved *= 2;
fRecords.realloc(fReserved);
- fTypes.realloc(fReserved);
}
size_t SkRecord::bytesUsed() const {
return fAlloc.approxBytesAllocated() +
- fReserved * (sizeof(Record) + sizeof(Type8)) +
+ (fReserved - kInlineRecords) * sizeof(Record) +
sizeof(SkRecord);
}