Regex: Precompiled vs Inline

Benchmark created on


Setup

const INLINE = /^Ai\b/;
const PRECOMPILED = new RegExp(/^Ai\b/);

Test runner

Ready to run.

Testing in
TestOps/sec
Inline
'Ai MAintaince'.replace(INLINE, 'AI')
ready
Precompiled
'Ai MAintaince'.replace(PRECOMPILED, 'AI')
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.