2 comments

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