in reply to Program slows dramatically!

I can't think of anything obvious where appending an empty string to a value causes a dramatic speed up. One non-obvious thing I can think of is that some of the $records->[$i]->{$field} records are undefined, and you have a $SIG{__WARN__} installed that is taking a long time (or STDERR is redirected to something that takes a long time). But that is rather far fetched, and not very likely.

You might have encountered an obscure bug in perl. Would you be able to write a small, stand alone program that exhibits this behaviour? Trying to create such a program is a dual cutting edge. If the bug is in your program, trying to find the minimal program exhibiting the unwanted behaviour often makes you see what bug you made; but if the bug is in perl, the people on p5p know where to look.

Abigail

Replies are listed 'Best First'.
Re: Re: Program slows dramatically!
by shemp (Deacon) on May 29, 2003 at 15:51 UTC
    It was indeed the problem with undefined values! I replaced the unusual fixer line with this code, and things worked fine.
    $records->[$i]->{$field} = "" if !defined $records->[$i]->{$field} +;
    The undefined values were getting in there because i was pulling the records from MySQL, and there are null fields.

    Thanks much.