local vs global regex performance in js functions (v2) (version: 0)
Do regular expressions become faster in javascript, when we put them in the global scope, or doesn't it matter when we declare them directly in a function?
Comparing performance of: regex directly in function vs regex in global scope
Memory measurements supported only in Chrome.
For precise memory measurements Chrome must be launched with --enable-precise-memory-info flag.
More information: Monitoring JavaScript Memory
Test case name
Result
regex directly in function
regex in global scope
Fastest:N/A
Slowest:N/A
Latest run results:
Run details: (Test run date:
3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4692.8 Safari/537.36