annotate: do not construct attr.s object per line while computing history
Unfortunately, good abstraction has a cost. It's way slower to construct
an annotateline() object than creating a plain tuple or a list. This patch
changes the internal data structure from row-based to columnar, so the
decorate() function can be instant (i.e. no Python in hot loop.)
For code readability, the outermost tuple is switched to an attr.s object
instead.
(original, row-based attr.s)
$ hg annot mercurial/commands.py --time > /dev/null
time: real 11.470 secs (user 11.400+0.000 sys 0.070+0.000)
$ hg annot mercurial/commands.py --time --line-number > /dev/null
time: real 39.590 secs (user 39.500+0.000 sys 0.080+0.000)
(this patch, columnar)
$ hg annot mercurial/commands.py --time > /dev/null
time: real 11.780 secs (user 11.710+0.000 sys 0.070+0.000)
$ hg annot mercurial/commands.py --time --line-number > /dev/null
time: real 12.240 secs (user 12.170+0.000 sys 0.090+0.000)
(cf. 4.3.3, row-based tuple)
$ hg annot mercurial/commands.py --time --line-number > /dev/null
time: real 19.540 secs (user 19.460+0.000 sys 0.080+0.000)
#require test-repo
$ . "$TESTDIR/helpers-testrepo.sh"
$ cd "$TESTDIR"/..
$ testrepohg files 'set:(**.py)' \
> -X hgdemandimport/demandimportpy2.py \
> | sed 's|\\|/|g' | xargs $PYTHON contrib/check-py3-compat.py
contrib/python-zstandard/setup.py not using absolute_import
contrib/python-zstandard/setup_zstd.py not using absolute_import
contrib/python-zstandard/tests/common.py not using absolute_import
contrib/python-zstandard/tests/test_buffer_util.py not using absolute_import
contrib/python-zstandard/tests/test_compressor.py not using absolute_import
contrib/python-zstandard/tests/test_compressor_fuzzing.py not using absolute_import
contrib/python-zstandard/tests/test_data_structures.py not using absolute_import
contrib/python-zstandard/tests/test_data_structures_fuzzing.py not using absolute_import
contrib/python-zstandard/tests/test_decompressor.py not using absolute_import
contrib/python-zstandard/tests/test_decompressor_fuzzing.py not using absolute_import
contrib/python-zstandard/tests/test_estimate_sizes.py not using absolute_import
contrib/python-zstandard/tests/test_module_attributes.py not using absolute_import
contrib/python-zstandard/tests/test_train_dictionary.py not using absolute_import
setup.py not using absolute_import
#if py3exe
$ testrepohg files 'set:(**.py) - grep(pygments)' \
> -X hgdemandimport/demandimportpy2.py \
> -X hgext/fsmonitor/pywatchman \
> | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py \
> | sed 's/[0-9][0-9]*)$/*)/'
hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob)
mercurial/cffi/bdiff.py: error importing: <ImportError> cannot import name '_bdiff' (error at bdiff.py:*)
mercurial/cffi/bdiffbuild.py: error importing: <ImportError> No module named 'cffi' (error at bdiffbuild.py:*)
mercurial/cffi/mpatch.py: error importing: <ImportError> cannot import name '_mpatch' (error at mpatch.py:*)
mercurial/cffi/mpatchbuild.py: error importing: <ImportError> No module named 'cffi' (error at mpatchbuild.py:*)
mercurial/cffi/osutilbuild.py: error importing: <ImportError> No module named 'cffi' (error at osutilbuild.py:*)
mercurial/scmwindows.py: error importing: <*Error> No module named 'msvcrt' (error at win32.py:*) (glob)
mercurial/win32.py: error importing: <*Error> No module named 'msvcrt' (error at win32.py:*) (glob)
mercurial/windows.py: error importing: <*Error> No module named 'msvcrt' (error at windows.py:*) (glob)
#endif
#if py3exe py3pygments
$ testrepohg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
> | xargs $PYTHON3 contrib/check-py3-compat.py \
> | sed 's/[0-9][0-9]*)$/*)/'
#endif