aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkStream.h
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-04-11 19:41:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-11 19:41:48 -0700
commitcbc060a70007bcdcc180d74b552f30104c88a805 (patch)
tree8c1c9a9ca0796e27d1c8dc1e979acf522204dfd9 /include/core/SkStream.h
parent74b8d323323c8533e3e5cc7719e0bd127aacd829 (diff)
SkWStream::writeText inlined.
Motivation: This function is used throughout SkPDF. Note that the compiler can usually inline the result of strlen() for literal strings. Before: out/Release/nanobench -m WStreamWriteText -q Timer overhead: 24.2ns ! -> high variance, ? -> moderate variance micros bench 6.10 WStreamWriteText nonrendering After: out/Release/nanobench -m WStreamWriteText -q Timer overhead: 23.9ns ! -> high variance, ? -> moderate variance micros bench 2.51 WStreamWriteText nonrendering PDF runtime change: -0.8% ±0.04%. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1844343004 Review URL: https://codereview.chromium.org/1844343004
Diffstat (limited to 'include/core/SkStream.h')
-rw-r--r--include/core/SkStream.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index a6a62c42ba..4bfaeda587 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -200,7 +200,10 @@ public:
bool write16(U16CPU);
bool write32(uint32_t);
- bool writeText(const char text[]);
+ bool writeText(const char text[]) {
+ SkASSERT(text);
+ return this->write(text, strlen(text));
+ }
bool writeDecAsText(int32_t);
bool writeBigDecAsText(int64_t, int minDigits = 0);
bool writeHexAsText(uint32_t, int minDigits = 0);