replaceAll vs str map for newline

Benchmark created on


Setup

var currentValue = 'aasds\\nasdsad\\nasdsad\\nasdasdsa\\nasdasd\\nasdasd\\n'

Test runner

Ready to run.

Testing in
TestOps/sec
replaceAll
currentValue?.replaceAll('\\n','\n');
ready
str map
currentValue.split('\\n').map(str => str).join('\n')
ready

Revisions

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