Re: Speeding up an application - general rules



"Petyr David" <phynkel@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 Perl
filter and modify the matching patterns?

Probably not. It should be a 30 second job to take out the sed pipe.
Sure, the answers will now be wrong, but unless it gives the wrong answers
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 pattern
faster than using the find command?

Probably not. Also, Perl's grep (currently) forces the list to be
evaluated to completion (in memory) before it gets started, so potentially
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
.



Relevant Pages

  • Re: Speeding up an application - general rules
    ... Server's NFS file system. ... The file names and matching patterns are returned to the ... the script uses perl's system command to run a long winded ...
    (comp.lang.perl.misc)
  • Re: Speeding up an application - general rules
    ... I will also review those URLS. ... The file names and matching patterns are returned to the ... "find" command which is piped to sed to correct patterns that match ...
    (comp.lang.perl.misc)
  • Re: Speeding up an application - general rules
    ... The file names and matching patterns are returned to the ... the script uses perl's system command to run a long winded ...
    (comp.lang.perl.misc)
  • Re: Greenspunning ML (revisited)
    ... to be embedded in individual branches where alternative patterns are ... Lisp with some kind of closed algebraic data types equivalent to ML's ... ML's pattern matching was designed to make it easy to convey ... statically-checked constraints. ...
    (comp.lang.lisp)
  • Re: find record on load
    ... I took Tom's advice and tacked on the criteria portion with the command ... matching fields, it would create a new record. ... So in the load event of the ... The form that opens has the ...
    (microsoft.public.access.formscoding)