Currently, revlog index entries are tuples.
This commit introduces a new type to represent revlog v1 index
entries. The pure Python parser has been converted to use it.
To provide backwards compatibility with existing code (including the
C extension), the type has a getitem to facilitate index
lookups. The intent is to remove this getitem once all consumers
are using named attributes.
Since the pure Python index parser is now using our new type,
test-parseindex2.py had to be updated to deal with the type mismatch.
Once all index parsers are converted and the new type/interface is
ubiquitous, we can restore the simplicity of test-parseindex2.py. We
also had to (temporarily) add "# no-check-code" to test-parseindex2.py
to allow the import of the pure module. This will be removed once the C
extension is ported.
Because consumers are going through an extra Python function call to
getitem to resolve attributes by index, this change regresses
performance on a simple DAG walking revset for the Firefox repository:
$ HGMODULEPOLICY=py hg perfrevset '::tip'
! wall 1.366281 comb 1.360000 user 1.360000 sys 0.000000 (best of 7)
! wall 1.860068 comb 1.860000 user 1.860000 sys 0.000000 (best of 5)
Using PyPy, a major regression is not apparent:
! wall 0.163141 comb 0.160000 user 0.160000 sys 0.000000 (best of 56)
! wall 0.154325 comb 0.160000 user 0.160000 sys 0.000000 (best of 54)
Perhaps you mean list(map(...)) instead of a list of one element?