2 comments

[ 3.8 ms ] story [ 11.0 ms ] thread
tl;dr: str.count($\) was 1.5x faster compared to str.lines.count and didn't allocate additional memory.