in reply to Perl script performance help
Hi G0G0
Why do you need the @array? You could improve the required memory by changing
tomy @array = (1..1000000000); foreach (@array) {
(The first solution gives an "out of memory" on my system, the later runs in 50 seconds with an empty loop).foreach (1..1000000000) {
Inside the loop, you can probably save some time by reversing only once, and storing the intermediate result in a temporary variable. And based on the size of the current number, you could determine which of the substr-lines is relevant and skip the others...
HTH, Rata
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl script performance help
by G0G0 (Initiate) on Jul 05, 2016 at 10:03 UTC | |
by GotToBTru (Prior) on Jul 05, 2016 at 12:48 UTC | |
by G0G0 (Initiate) on Jul 05, 2016 at 13:44 UTC |