in reply to performance - loops, sub refs, symbol tables, and if/elses
You assume you are cpu bound. You're right. But you are bound to be, cause you are waiting to read everything, bound to process it all, then waiting to write it. You may be solving the wrong problem.
It is not clear whether you have enough memory to avoid swapping. It is unknown whether you have other tasks running in your environment. Also unknown is whether you have multiprocessors.
Some ideas:
# off-hand untried code PROGRAM_INIT: my %proc_table = ( type => \&process, apple => \&apple_wash_core_pulp, banana => \&banana_bend_hang, ); foreach ( @item){ &$proc_table{$type} if exists $proc_table{$type}; next; unknown_type(); }
|
|---|