mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Cache scalar regexes
This improves performance on the test.yaml attached to #158 by about 35% on my machine (0.39s -> 0.25s), as measured by `time build/util/parse < test.yaml > /dev/null`.
This commit is contained in:

committed by
Jesse Beder

parent
9e37409b4b
commit
8c35a8ffab
@@ -165,6 +165,15 @@ inline const RegEx& EndScalarInFlow() {
|
||||
return e;
|
||||
}
|
||||
|
||||
inline const RegEx& ScanScalarEndInFlow() {
|
||||
static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment()));
|
||||
return e;
|
||||
}
|
||||
|
||||
inline const RegEx& ScanScalarEnd() {
|
||||
static const RegEx e = EndScalar() || (BlankOrBreak() + Comment());
|
||||
return e;
|
||||
}
|
||||
inline const RegEx& EscSingleQuote() {
|
||||
static const RegEx e = RegEx("\'\'");
|
||||
return e;
|
||||
|
Reference in New Issue
Block a user