[PATCH] D43892: [YAML] speed up isNumber by doing regex matching less often

Martin Pelikán via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 18:09:03 PST 2018


pelikan added inline comments.


================
Comment at: include/llvm/Support/YAMLTraits.h:479-480
 
-  return false;
+  Regex FloatMatcher("^(\\.[0-9]+|[0-9]+(\\.[0-9]*)?)([eE][-+]?[0-9]+)?$");
+  return FloatMatcher.match(S);
 }
----------------
dberris wrote:
> Does it make sense to make the `Regex` object `static` and `const` so that we only compile/initialise it once?
I was too lazy to look into Regex implementation to check whether it actually makes sense.  I bet the current version is faster though.


Repository:
  rL LLVM

https://reviews.llvm.org/D43892





More information about the llvm-commits mailing list