Slow Sorting

$

$_

This sort runs pretty slowly, any hints on how to speed this up?

foreach my $k (sort {$file{$b}[$col] cmp $file{$a}[$col]}
keys %file)

%file is a 'HoA', there are usually around 500 keys.
Each {key} has an anonymous [array] with 8 items.
The item data is mixed.. numbers, punctuation, letters.

Also is there a way the 'each' function could be used
to save memory?

Any help would just great. Thanks.
 
G

gnari

This sort runs pretty slowly, any hints on how to speed this up?

foreach my $k (sort {$file{$b}[$col] cmp $file{$a}[$col]}
keys %file)

%file is a 'HoA', there are usually around 500 keys.
Each {key} has an anonymous [array] with 8 items.
The item data is mixed.. numbers, punctuation, letters.

you probably are doing something wrong
this should not take a long time

gnari
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
EmeliaBryc

Latest Threads

Top