summaryrefslogtreecommitdiffstats
path: root/bin/text_cat
diff options
context:
space:
mode:
authorJeroen Nijhof <jeroen@nijhof.co.uk>2014-05-01 18:27:38 +0200
committerMichael Meeks <michael.meeks@collabora.com>2014-05-02 09:13:13 +0000
commit6efd9725912ae67bafbfe613220d9c09443ea0ba (patch)
tree9cfbb9c6e2599f122d8b0aaf5e20937f7607f722 /bin/text_cat
parentAvoid possible memory leaks in case of exceptions (diff)
downloadcore-6efd9725912ae67bafbfe613220d9c09443ea0ba.tar.gz
core-6efd9725912ae67bafbfe613220d9c09443ea0ba.zip
Speed up find-german-comments
Instead of recreating a text_cat sub-process for every string, start a single text-cat process (with the -s flag, "per line") and reuse that. Testing on svl/source shows a speed-up of 7.5 x, down from 45.6s to 6.1s! To avoid blocking on the pipes set autoflush in text-cat, and use read_line instead of read on the find-german-comments side. Change-Id: Ic6c00fc3c1e7cbcbbfff65512bf54ad11f900697 Reviewed-on: https://gerrit.libreoffice.org/9226 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'bin/text_cat')
-rwxr-xr-xbin/text_cat/text_cat2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/text_cat/text_cat b/bin/text_cat/text_cat
index 6c6b0d1d1483..c907f50b96bb 100755
--- a/bin/text_cat/text_cat
+++ b/bin/text_cat/text_cat
@@ -19,6 +19,8 @@ $opt_f ||= 0;
$opt_t ||= 400;
$opt_u ||= 1.05;
+$| = 1; # auto-flush stdout
+
sub help {
print <<HELP
Text Categorization. Typically used to determine the language of a