Blame is about 30% faster than grep
authornemo
Thu, 08 Nov 2018 11:34:01 -0500
changeset 14179 fac275de34e5
parent 14178 ef14da7670f1
child 14180 76a52e8149e3
Blame is about 30% faster than grep
tools/find_outdated_engine_translations.sh
--- a/tools/find_outdated_engine_translations.sh	Thu Nov 08 08:29:11 2018 -0500
+++ b/tools/find_outdated_engine_translations.sh	Thu Nov 08 11:34:01 2018 -0500
@@ -33,8 +33,10 @@
 TEMP_EN=$(mktemp);
 TEMP_LANG=$(mktemp);
 
+#hg fa en.txt | grep -P "^\s*\d+:\s+0[013-6]:" > $TEMP_EN;
 hg blame en.txt | grep -P "^\s*\d+:\s+0[013-6]:" > $TEMP_EN;
 
+#hg fa $BLAMELANGFILE | grep -P "^\s*\d+:\s+0[013-6]:" > $TEMP_LANG;
 hg blame $BLAMELANGFILE | grep -P "^\s*\d+:\s+0[013-6]:" > $TEMP_LANG;
 
 cat $TEMP_EN | while read f;
@@ -48,7 +50,9 @@
         if (($REV>$OTHER_REV));
         then
             TEXT=$(echo $f | sed 's/^\s*[0-9]\+:\s*[0-9]\+:[0-9]\+=//');
-            OLD_TEXT=$(hg grep --all -r "1:$OTHER_REV" "$CODE" en.txt | tail -n1 | sed 's/.*en.txt:[0-9]\+:[+-]:[0-9]\+:[0-9]\+=//;s/
//');
+			# script runs ~20% faster than with blame but nonstandard
+            # OLD_TEXT=$(hg fa -r "$OTHER_REV" en.txt | grep -P "^\s*\d+:\s+${CODE}=" | sed 's/^\s*[0-9]\+:\s*[0-9]\+:[0-9]\+=//;s/
//');
+            OLD_TEXT=$(hg blame -r "$OTHER_REV" en.txt | grep -P "^\s*\d+:\s+${CODE}=" | sed 's/^\s*[0-9]\+:\s*[0-9]\+:[0-9]\+=//;s/
//');
 
             COMPARE_TEXT=$TEXT;
             COMPARE_OLD_TEXT=$OLD_TEXT;