diff mercurial/demandimport.py @ 29223:c04ad3d3c651

annotate: optimize line counting We used len(text.splitlines()) to count lines. This allocates, copies, and deallocates an object for every line in a file. Instead, we use count("\n") to count newlines and adjust based on whether there's a trailing newline. This improves the speed of annotating localrepo.py from 4.2 to 4.0 seconds.
author Matt Mackall <mpm@selenic.com>
date Wed, 18 May 2016 16:37:32 -0500
parents c7f89ad87bae
children fcaf20175b1b
line wrap: on
line diff