RegEx Split vs Boolean Filter

Benchmark created on


Setup

const value = "This  is   a    string with     multiple      spaces.";

const regEx = /\s+/;

Test runner

Ready to run.

Testing in
TestOps/sec
RegEx Split
value.split(regEx).filter(Boolean);
ready
Boolean Filter
value.split(' ').filter(Boolean);
ready

Revisions

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