counting lines by splitting by, replacing, or looking for line breaks (version: 1)
Compares splitting a string and counting the array items to replacing line breaks with an empty string and computing the difference from the original length.
Comparing performance of: split vs replace vs look
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
split
replace
look
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_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15