D4150: linelog: optimize replacelines

quark (Jun Wu) phabricator at mercurial-scm.org
Thu Aug 9 18:12:39 EDT 2018


quark added a comment.


  To clarify, I do like stateless API is better. It can be done by keeping `_lastannotate` as a private cache inaccessible from other APIs, move `annotateresult` to the return value of `annotate`, then add `arev` to `replacelines` to verify the cache. The C code use `brev` instead of `rev` as the parameter name for a reason.
  
  The original `annotateresult` is used as an attempt to reduce C code to be reviewed. Reviewing C code took too long.
  
  The choice of C was because I pursued performance, C is not bad for this particular work (ex. linelog.c has similar LOC), and C is also friendly for the Git community.
  
  To provide more context, mpm commented internally on how the linelog format might be improved. That is to add a `LINESPAN` instruction replacing a range of continuous LINE instructions. Again, not implemented because of C. But it seems much easier with Python now.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4150

To: quark, #hg-reviewers, durin42
Cc: durin42, mercurial-devel


More information about the Mercurial-devel mailing list