Paul Johnson wrote:
On Sun, Nov 02, 2003 at 05:46:22PM -0500, Dan Anderson wrote:

I created a pretty simple Perl script to create .m3u files for all
genres in my music library.  (I eventually want to expand the script to
be able to create music match like playlists on the fly).

The problem I'm running into is that for only 150 songs the following
code takes over 5 seconds to execute:  (My computer is not bad ass, but
certainly not wimpy at 1 Ghz).  I was wondering if anyone could suggest
ways to speed it up.

The particularly slow part is:

# now write out the genres...
# first we need to get a list of possible genres...
@temp = @entries;
my @possible_genres;
my %possible_genres;
while ($_ = pop @temp) {
 # bring back the information..
 my %entry = eval ($_);


For a quick answer, this is almost certainly the problem.  You should be
drilling down into the data structure.  Eval is slow and not good style.

I'm sure someone else can give more details if required.

Definately. Every call to eval() requires Perl to invoke the compiler to turn that line into bytecode to pass back to the interpreter.


--
Andrew Gaffney


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to