Improve line counting speed