V8caching是否自动编译正则expression式?

所以我知道在JavaScript中实例化一个正则expression式会导致它被自动编译,如果这个正则expression式存储在一个variables中,它将被重用而不用重新编译。 例:

var re = /[Ff]oo|[Bb]ar/; "Foo".match(re); // ["Foo"] "Baz".match(re); // null 

但是,重新编译的正则expression式是重复的还是V8(Chrome / Node.js)智能地重新使用它们(就像PHP与preg_ *函数一样)?

 function isFooBar(str) { return str.match(/[Ff]oo|[Bb]ar/); } isFooBar("Foo"); // ["Foo"] isFooBar("Baz"); // null 

所以为了澄清,我知道第一个例子导致了正则expression式的汇编。 但是第二个例子呢?

       

网上收集的解决方案 "V8caching是否自动编译正则expression式?"

那么,让我们来看看。

 // http://stackoverflow.com/questions/3466850/complex-password-regular-expression function isFooBar(str) { return str.match(/^(?:(?=.*[az])(?:(?=.*[AZ])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[AZ])(?=.*\d)).{8,}(?:(?=.*[az])(?:(?=.*[AZ])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[AZ])(?=.*\d)).{8,}(?:(?=.*[az])(?:(?=.*[AZ])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[AZ])(?=.*\d)).{8,}(?:(?=.*[az])(?:(?=.*[AZ])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[AZ])(?=.*\d)).{8,}(?:(?=.*[az])(?:(?=.*[AZ])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[AZ])(?=.*\d)).{8,}(?:(?=.*[az])(?:(?=.*[AZ])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[AZ])(?=.*\d)).{8,}(?:(?=.*[az])(?:(?=.*[AZ])(?=.*[\d\W])|(?=.*\W)(?=.*\d))|(?=.*\W)(?=.*[AZ])(?=.*\d)).{8,}(?:(?=.*[az])(?:(?=.*[AZ])(?=.*[\d\W])|(?=.*\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]).*$)?(^(?=.*\d)(?=.*[az])(?=.*[AZ]).*$)?(^(?=.*\d)(?=.*[az])(?=.*[@#$%^&+=]).*$)?(^(?=.*\d)(?=.*[AZ])(?=.*[@#$%^&+=]).*$)?(^(?=.*[az])(?=.*[AZ])(?=.*[@#$%^&+=]).*$)?(^(?=.*\d)(?=.*[az])(?=.*[AZ]).*$)?(^(?=.*\d)(?=.*[az])(?=.*[@#$%^&+=]).*$)?(^(?=.*\d)(?=.*[AZ])(?=.*[@#$%^&+=]).*$)?(^(?=.*[az])(?=.*[AZ])(?=.*[@#$%^&+=]).*$)?(^(?=.*\d)(?=.*[az])(?=.*[AZ]).*$)?(^(?=.*\d)(?=.*[az])(?=.*[@#$%^&+=]).*$)?(^(?=.*\d)(?=.*[AZ])(?=.*[@#$%^&+=]).*$)?(^(?=.*[az])(?=.*[AZ])(?=.*[@#$%^&+=]).*$)?(^(?=.*\d)(?=.*[az])(?=.*[AZ]).*$)?(^(?=.*\d)(?=.*[az])(?=.*[@#$%^&+=]).*$)?(^(?=.*\d)(?=.*[AZ])(?=.*[@#$%^&+=]).*$)?(^(?=.*[az])(?=.*[AZ])(?=.*[@#$%^&+=]).*$)?$/); } console.time('1');isFooBar("Foo");console.timeEnd('1'); console.time('2');isFooBar("Bar");console.timeEnd('2'); 

http://code.google.com/p/v8/issues/detail?id=933#c3

在Chrome 9中,我们已经移除了RegExp结果的原始caching。 这意味着我们不再需要一次又一次地在同一个input上重复同样的操作。 最初添加caching是为了说明过于简单(当时包括我们自己)在内的基准,通过添加这种caching(这在现实世界的场景中没有什么区别)太容易“游戏”了。 大多数的基准testing已经得到了很大的改进,所以我们决定删除caching(以及不可避免的开销)。 该caching已添加到v8修订版4083(在Chrome 5中发布)中,并在修订版5755中删除(将在Chrome 9中)