Mercurial > hg
view tests/test-dispatch.py.out @ 20836:a8b4541bb961
grep: reuse the first "util.binary()" result for efficiency
Before this patch, to check whether the file in the specified revision
is binary or not, "util.binary()" is invoked via internal function
"binary()" of "hg grep" once per a line of "hg grep" output, even
though binary-ness is not changed in the same file.
This patch reuses the first "util.binary()" invocation result by
annotating internal function "binary()" with "@util.cachefunc".
Performance improvement measured by "hgperf grep -r 88d8e568add1 vfs
mercurial/scmutil.py":
before this patch:
! wall 0.024000 comb 0.015600 user 0.015600 sys 0.000000 (best of 118)
after this patch:
! wall 0.023000 comb 0.015600 user 0.015600 sys 0.000000 (best of 123)
Status of recent(88d8e568add1) "mercurial/scmutil.py":
# of lines: 919 (may affect cost of search)
# of bytes: 29633 (may affect cost of "util.binary()")
# of matches: 22 (may affect frequency of "util.binary()")
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 15 Feb 2014 19:52:36 +0900 |
parents | 883d887c6408 |
children | 6f9ac3cb0987 |
line wrap: on
line source
running: init test1 result: None running: add foo result: 0 running: commit -m commit1 -d 2000-01-01 foo result: None running: commit -m commit2 -d 2000-01-02 foo result: None running: log -r 0 changeset: 0:0e4634943879 user: test date: Sat Jan 01 00:00:00 2000 +0000 summary: commit1 result: None running: log -r tip changeset: 1:45589e459b2e tag: tip user: test date: Sun Jan 02 00:00:00 2000 +0000 summary: commit2 result: None