Sujet : Re: How to speed up a script by threading?
De : ralfixx (at) *nospam* gmx.de (Ralf Fassel)
Groupes : comp.lang.tclDate : 19. Jul 2024, 10:08:14
Autres entêtes
Message-ID : <ygaikx13g1t.fsf@akutech.de>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
* 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'