Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: map versus forby MidLifeXis (Monsignor) |
on Aug 04, 2008 at 17:06 UTC ( [id://702123]=note: print w/replies, xml ) | Need Help?? |
I have not done much with perl profiling, but when doing a performance comparison, don't you need to return the same results? It looks like the test_for returns the number of elements in the post-push array, whereas test_map returns the new array, at least if I am reading push correctly. Update:Note that I am not saying that the results will change much. In fact, here are mine for 60 seconds. test_for2 does a return of the array at the end of the test function.
Update 2: Would some kind monk be willing to comment on if it is sufficient to just define the raw function (as in the OP), or would you also need to have the function return into a context of some sort. In other words, should there be another layer of function call here to force list context to make this a valid comparison? --MidLifeXis
In Section
Seekers of Perl Wisdom
|
|