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

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 17:44:05 PST 2018


dberris added reviewers: rnk, zturner.
dberris added a comment.

Adding Reid and Zach who might be able to give more insight here.



================
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);
 }
----------------
Does it make sense to make the `Regex` object `static` and `const` so that we only compile/initialise it once?


Repository:
  rL LLVM

https://reviews.llvm.org/D43892





More information about the llvm-commits mailing list