regex replace vs regex split/join

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
regex replace
'abc def $&*9'.replace(/[^a-zA-Z0-9]+/g, '_');
ready
regex split / join
'abc def $&*9'.split(/[^a-zA-Z0-9]+/).join('_');
ready

Revisions

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