Deutsch   English   Français   Italiano  
<ygaikx13g1t.fsf@akutech.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Ralf Fassel <ralfixx@gmx.de>
Newsgroups: comp.lang.tcl
Subject: Re: How to speed up a script by threading?
Date: Fri, 19 Jul 2024 11:08:14 +0200
Lines: 23
Message-ID: <ygaikx13g1t.fsf@akutech.de>
References: <nkmdnbODp8_zvQf7nZ2dnZfqn_udnZ2d@brightview.co.uk>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net TIG3deCnKjmrC4FvFzHdHwk/1Pl8lXt+wTKzYRVu1qdvefE1Y=
Cancel-Lock: sha1:p3wLHE3n4wsMJVAINwNqoePiNtc= sha1:VkglbZgdm8dbh5c9G9++KN2igo8= sha256:Qn8MCD70oirSZHA0oGAq1Uqwzf2fv07yZisuK3FBkqo=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Bytes: 1357

* Mark Summerfield <mark@qtrac.eu>
| The program below (~95 LOC) is very slow.
| One way to speed it up would be to process each directory given on the 
| command line in its own thread.
| But I can't see how to do this.
| Or is there a better way to make it faster?
| I'm using Tcl/Tk 9.0b2 on Linux.

Since you give the directories on the (linux) commandline, put the
one-thread-per-dir one level up:

Instead of
  your-prog dir1 dir2 dir3 ...
do
  for dir in dir1 dir2 dir3 ... ; do
    your-prog $dir &
  done

That way multiple processes (not threads) run in parallel,
and you don't have to change the program at all.

My 0.02.
R'