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:
Scott Wolchok
2016-01-07 15:16:52 -08:00
committed by Jesse Beder
parent 8c35a8ffab
commit 005a6a19ee
4 changed files with 17 additions and 6 deletions

View File

@@ -20,6 +20,10 @@ namespace YAML {
namespace Exp {
// misc
inline const RegEx& Empty() {
static const RegEx e;
return e;
}
inline const RegEx& Space() {
static const RegEx e = RegEx(' ');
return e;