Without studying your code (220 lines is a lot to ask of freebie help; 20 illustrating the same problem is much preferred), you might want to try profiling your code -- Dev::Deprof, Devel:NYTProf, etc. -- though your problem may be in the access time for data stored (somewhere... where?) with your "legacy...application." Also, you're running a lot of counters, each of which eats up cycles and could, as they and your export files get larger, slow your process.
And (afterthought!) if your data is in CSV files, why not inport the old data to a DB -- MySQL, SQLite, etc, and let the database engine do the counting and sorting? If necessary (and you may be able to export more-or-less direct to Excel files) the worst (IMO) that does is require you to reexport to CSV's and then export/store those as Excel files.
Hope this helps; I know it's not a careful review of your code nor an Rx for optomizing it, but as I said above, a post with 200+ lines of code (and no data) is a lot with which to burden the Monks. Please On asking for help & How do I post a question effectively?.
In reply to Re: Optimization of script
by ww
in thread Optimization of script
by JulioRD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |