good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Long list is longby kcott (Archbishop) |
on Oct 30, 2022 at 04:12 UTC ( [id://11147826]=note: print w/replies, xml ) | Need Help?? |
G'day Chuma, A number of problems with the code you posted:
From your description, I'd say the bottleneck lies with the population of the three arrays: @p, @q and @i. This is all unnecessary work and those arrays are not even needed. See "perlperf - Perl Performance and Optimization Techniques", for benchmarking and profiling techniques, to get a clearer picture of where problems lie. I created these three dummy test files. In case you're unfamiliar with cat -vet, ^I represents a tab and $ represents a newline.
Then this test code:
Output (raw and showing special characters):
Try that with your real files. I suspect it should be faster and not have the bottlenecks. Let us know if you still have problems: show your new code and profiling output (in <readme> or <spoiler> tags). — Ken
In Section
Seekers of Perl Wisdom
|
|