From 98a00bc02584af9e08d39cc3d6a6d0cded993743 Mon Sep 17 00:00:00 2001 From: IIMarckus Date: Sat, 17 Dec 2011 00:48:24 -0700 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20rebuild=20the=20character=20tab?= =?UTF-8?q?le=20every=20line.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change halves execution time on my machine. hg-commit-id: aa8e5c92d38c --- textpre.awk | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/textpre.awk b/textpre.awk index a3192ab2..464741c5 100644 --- a/textpre.awk +++ b/textpre.awk @@ -1,15 +1,6 @@ BEGIN { FS = "\"" -} -# skip lines that actually do use ASCII in quotes -tolower($1) ~ /section/ || -tolower($1) ~ /include/ || -tolower($1) ~ /incbin/ - -!(tolower($1) ~ /section/ || tolower($1) ~ /include/ || tolower($1) ~ /incbin/) { -i = 1 -ORS = "" char[" "] = "$7F" char["A"] = "$80" char["B"] = "$81" @@ -80,6 +71,16 @@ char["6"] = "$FC" char["7"] = "$FD" char["8"] = "$FE" char["9"] = "$FF" +} + +# skip lines that actually do use ASCII in quotes +tolower($1) ~ /section/ || +tolower($1) ~ /include/ || +tolower($1) ~ /incbin/ + +!(tolower($1) ~ /section/ || tolower($1) ~ /include/ || tolower($1) ~ /incbin/) { +i = 1 +ORS = "" while (i <= NF) { if (i % 2 == 1)