Faster and easier to read and understand, and higher performance.
Rewrite the count_lines for performance
Faster and easier to read and understand.
Improve the count_lines fucntion
don't consider empty lines.
Sorry we missed this pull request when you first opened it.
Do you have the benchmarking code you used to test this? I can believe it would be faster but I'm curious to see by how much (and what difference it makes in various engines.)
Also /\n+/ should be /\n/ otherwise you don't count double empty lines correctly - but it looks like there aren't any tests for this yet. Our bad.