For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2006 > How to improve speed of returning value from calling method on an









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to improve speed of returning value from calling method on an
Sai Tong

2006-01-10, 4:02 am


Hi,

I have an array of many objects and I want to call a method on
each of these objects and the save the returned values into an array:

my @return_values;
foreach my $retrievedObject (@array_of_objects) {
push (@return_values , $retrievedObject->method );
}

The problem is this code runs too slowly for a large array of objects.
Its seems that it might be a little too slow to "push" each
returned value into @return_values . Can anyone suggest the best way to
improve the speed of putting the returned value of
each object into an array?

thanks,
Sai



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com