in reply to Improving SQL speed

Not necessarily speed tips, but some style thing.

--MidLifeXis

Replies are listed 'Best First'.
Re^2: Improving SQL speed
by Mad_Mac (Beadle) on Nov 02, 2009 at 08:22 UTC
    Thanks. Appreciate the tips.
Re^2: Improving SQL speed
by Mad_Mac (Beadle) on Nov 02, 2009 at 18:57 UTC

    OK, so I worked through your suggestions:

  • Thanks
  • Got it. I was trying to be explicit in the debugging phase, but now that it's working I changed it per your suggestion.
  • OK. I had them declared early on becuase I thought I was getting an error declaring them within the sub-function, but apparently not. I changed them as you recommended and it works fine.
  • Thanks! Can the same trick be used on if (exists $mp3->{ID3v1}) {?
  • Yea, Part of that is because I kept changing the way I wanted to use those variables as my code evolved ... part of it's because I've only been working in Perl again for a few weeks after a 10+ year hiatus, and part of it's becuase I occasionally get warnings from Perl that calling certain array variables like @songinfo[0] would be better referenced as $songinfo[0]. Which makes me think I don't really understand Perl variables yet. So I just keep mucking with it (and plagiarizing other peoples code) 'till it does what I want.
  • After making the changes you suggested, the code seems to be ~10% faster, but I'm not sure. I'm going to add a timer and run it the old way and with your changes. We'll see.

    Thanks again for your suggestions.

    Mad Mac

      Any speed improvement is unintentional. My suggestions were purely for maintenance and readability (speaking Perl, in effect). If it is faster, I take cookies ;-)

      --MidLifeXis