mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Avoid copying cached RegExes for scalars
This improves performance on the test.yaml attached to #158 by about 25% on my machine as compared to the previous commit (0.25s -> 0.20s), as measured by `time build/util/parse < test.yaml > /dev/null`.
This commit is contained in:

committed by
Jesse Beder

parent
8c35a8ffab
commit
005a6a19ee
@@ -19,7 +19,8 @@ enum FOLD { DONT_FOLD, FOLD_BLOCK, FOLD_FLOW };
|
||||
|
||||
struct ScanScalarParams {
|
||||
ScanScalarParams()
|
||||
: eatEnd(false),
|
||||
: end(nullptr),
|
||||
eatEnd(false),
|
||||
indent(0),
|
||||
detectIndent(false),
|
||||
eatLeadingWhitespace(0),
|
||||
@@ -32,7 +33,8 @@ struct ScanScalarParams {
|
||||
leadingSpaces(false) {}
|
||||
|
||||
// input:
|
||||
RegEx end; // what condition ends this scalar?
|
||||
const RegEx* end; // what condition ends this scalar?
|
||||
// unowned.
|
||||
bool eatEnd; // should we eat that condition when we see it?
|
||||
int indent; // what level of indentation should be eaten and ignored?
|
||||
bool detectIndent; // should we try to autodetect the indent?
|
||||
|
Reference in New Issue
Block a user