2 comments

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