Re: Speeding up an application - general rules
- From: "Petyr David" <phynkel@xxxxxxxxx>
- Date: 22 Dec 2006 04:41:31 -0800
I haven't yet done any measuring of the CPU usage for the processes,
but will look into that -TX. I just heard yesterday (the day of my
post) that the application was bogging down. When I do my testing, I'm
working with live, production data, but typically limit my search to
one of three patterns and do it on only one or two directories. I want
to get my results back quickly. The users of this app apparently make
heavy use of this and are looking for the "needle in a haystack".
On Dec 22, 1:26 am, xhos...@xxxxxxxxx wrote:
"Petyr David" <phyn...@xxxxxxxxx> wrote:
Basically: the script uses perl's system command to run a long winded
"find" command which is piped to sed to correct patterns that match
HTML markers. The matching lines are then shoved into an array. The
elements of the array are moved into a hash for the purpose of sorting
the file names. Then file names and matching lines are printed.
Q: Can I speed things by eliminating the sed command and letting PerlSure, the answers will now be wrong, but unless it gives the wrong answers
filter and modify the matching patterns?Probably not. It should be a 30 second job to take out the sed pipe.
much faster than it used to, you will know there is no speed benefit to be
had by rewriting the sed into Perl.
If so, how much of a
performance gain?
Is using Perl's grep to search through every file for the patternevaluated to completion (in memory) before it gets started, so potentially
faster than using the find command?Probably not. Also, Perl's grep (currently) forces the list to be
takes much more memory. You may want to look at Perl's File::Find,
although I see no particular reason to think it will be faster than the
system's find.
The find command has the advantage
that I can search for files of a certain date rather easily. Again:
could that be done more rapidly by Perl's looking at the file's mod
time?Probably not more rapidly, no.
What is the total CPU usage? What is the relative usage of each process
(perl, find, sed)?
Xho
--
--------------------http://NewsReader.Com/--------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
- References:
- Speeding up an application - general rules
- From: Petyr David
- Re: Speeding up an application - general rules
- From: xhoster
- Speeding up an application - general rules
- Prev by Date: PerlCtrl and C++
- Next by Date: Should i disable Nagel's Algorithm in my http client?
- Previous by thread: Re: Speeding up an application - general rules
- Next by thread: Re: Speeding up an application - general rules
- Index(es):
Relevant Pages
|