in reply to Re^2: sort routines crossing package lines
in thread sort routines crossing package lines

According to other monks' messages, below, you can sort short lists in microseconds or nanoseconds. So even though your lists have thousands of elements, I doubt that sorting is the cause of your speed concerns.

Profile your program.

I bet you'll find huge whacks of time spent copying arrays in a function call in an inner loop, where you should be passing a reference, or some other efficiency error. Or it might be your algorithmn that needs some re-thinking. Are you processing things in an item-by-item loop, when you could leave Perl to process the whole set at once?

--
TTTATCGGTCGTTATATAGATGTTTGCA

  • Comment on Re^3: sort routines crossing package lines

Replies are listed 'Best First'.
Re^4: sort routines crossing package lines
by DrWhy (Chaplain) on Nov 26, 2004 at 14:52 UTC
    This is a good point. I actually believe the big time hog is the large number of separate (and in some cases rather complex) queries made on the backend database. There may be some issues with passing/assigning arrays/hashes, but I've quashed alot of things like that already with no humanly noticeable improvement in speed.

    As for the impact of prototyped vs unprototyped sort routines I timed a portion of the code that does a lot of sorting with each version. The prototyped version added about a hundredth of a second to execution time (1.371 vs 1.382 seconds). So I've gone with the more straightforward prototyped implementation, ignoring the minute slowdown.

    --DrWhy

    "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."