aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLParser.h
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-08-15 11:14:30 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-15 15:38:26 +0000
commit634624a1850b335aa7cdfd6aec02e687ee8571a5 (patch)
tree010aed2c4aec9cda27dc4493748f707c77b0cd4e /src/sksl/SkSLParser.h
parent4009668cb828b2a0647b8316fa00af2980cf21d3 (diff)
Micro optimizations to SkSL parser
Some of these are pretty trivial, but a few really moved the needle. In total, this cut the time in the parser by about 10% in my profiling. The early returns from peek and checkNext are probably the biggest wins, everything else is mostly about cutting down on string copying. Bug: skia: Change-Id: I3da0a0cfbc557e8cef480cb3a7d301c2b3f8802a Reviewed-on: https://skia-review.googlesource.com/34720 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/sksl/SkSLParser.h')
-rw-r--r--src/sksl/SkSLParser.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/sksl/SkSLParser.h b/src/sksl/SkSLParser.h
index 22ef7bc1e9..4edd8e4e02 100644
--- a/src/sksl/SkSLParser.h
+++ b/src/sksl/SkSLParser.h
@@ -103,7 +103,6 @@ private:
* Returns true if the read token was as expected, false otherwise.
*/
bool expect(Token::Kind kind, const char* expected, Token* result = nullptr);
- bool expect(Token::Kind kind, String expected, Token* result = nullptr);
void error(Position p, const char* msg);
void error(Position p, String msg);
@@ -112,7 +111,7 @@ private:
* Returns true if the 'name' identifier refers to a type name. For instance, isType("int") will
* always return true.
*/
- bool isType(String name);
+ bool isType(const String& name);
// these functions parse individual grammar rules from the current parse position; you probably
// don't need to call any of these outside of the parser. The function declarations in the .cpp