mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 13:01:18 +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
@@ -298,7 +298,7 @@ void Scanner::ScanPlainScalar() {
|
||||
// set up the scanning parameters
|
||||
ScanScalarParams params;
|
||||
params.end =
|
||||
(InFlowContext() ? Exp::ScanScalarEndInFlow() : Exp::ScanScalarEnd());
|
||||
(InFlowContext() ? &Exp::ScanScalarEndInFlow() : &Exp::ScanScalarEnd());
|
||||
params.eatEnd = false;
|
||||
params.indent = (InFlowContext() ? 0 : GetTopIndent() + 1);
|
||||
params.fold = FOLD_FLOW;
|
||||
@@ -338,7 +338,8 @@ void Scanner::ScanQuotedScalar() {
|
||||
|
||||
// setup the scanning parameters
|
||||
ScanScalarParams params;
|
||||
params.end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote));
|
||||
RegEx end = (single ? RegEx(quote) && !Exp::EscSingleQuote() : RegEx(quote));
|
||||
params.end = &end;
|
||||
params.eatEnd = true;
|
||||
params.escape = (single ? '\'' : '\\');
|
||||
params.indent = 0;
|
||||
|
Reference in New Issue
Block a user