On Wed, Oct 23, 2019 at 5:12 PM Joel Scarfone <joelrscarf...@gmail.com> wrote:
> Hi! > > I'm looking for details on how v8's regular expression optimizations work > under the covers, and if there might be something to improve the > performance of a given regular expressions first execution. From what it > looks like trying some things out, v8 does most of it's optimizations after > a call that uses the RegExp and not when the constructor is called (eg. > through `new RegExp()`). > I'm not aware of much documentation on this topic. A recent blog post ( https://v8.dev/blog/regexp-tier-up) discusses the recent addition of tiering and describes performance work on the interpreter. But for details you'll have to dig through the source code. As you say, a regexp is compiled lazily at the first exec call. With tiering, we first compile to bytecode, then later recompile to native code. There are many intricacies involved, e.g. we cache compilation artifacts keyed on {pattern,flags}, and constructing a regexp instance is expected to be cheaper from a literal (/abc/) than when using the constructor (new RegExp("abc", "")). > > I am Wondering what some options are in this area to move around the cost > of compiling/running the regular expression. > I think I'd need more details on what you want to achieve to give a meaningful answer. > > Thanks in advance! > > Joel > > -- > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to v8-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/v8-users/05a13931-5a1d-4b21-8616-ffd3010dd03a%40googlegroups.com > <https://groups.google.com/d/msgid/v8-users/05a13931-5a1d-4b21-8616-ffd3010dd03a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/CAH3p7oMfNbHjpW8w%3DhO4QUNNE%2BsH_j8UVupNF86%2BKkaZYxz2JQ%40mail.gmail.com.