antirice has asked for the wisdom of the Perl Monks concerning the following question:
I am aware that eval is pretty slow. I am using an array to store the order through which data should be passed between subs. When the path is determined, a number of values will be processed through the subs referenced by this array. What I'd prefer to do is avoid the overhead of iterating through this array and just create a temp sub that processes everything in place. I can easily create something to write this sub. What I was wondering concerns speed. Should I eval the text for the sub or should I write out to a file and require it? Please note that these steps sometimes takes up to half an hour to process in short bursts and then the script is rerun with different parameters to create a new path that the data must use. I cannot generate these paths beforehand as the paths change based upon a number of factors at runtime. I understand that eval vs require shouldn't be my biggest problem but as an academic excercise, which is faster?
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: require vs eval
by BrowserUk (Patriarch) on Jun 16, 2003 at 21:01 UTC | |
by antirice (Priest) on Jun 16, 2003 at 21:52 UTC | |
|
Re: require vs eval
by chromatic (Archbishop) on Jun 16, 2003 at 20:25 UTC | |
|
Re: require vs eval
by bobn (Chaplain) on Jun 16, 2003 at 20:39 UTC |