Jonathan Vanasco wrote:

On May 17, 2007, at 11:53 AM, Michael Peters wrote:

I would imagine the 2nd to be marginally faster. Perl doesn't have to
re-allocate memory for the array each time the sub is called, but it does have to re-initialize it. As long as the array's contents are constant I'd go with the 2nd example, although I'd slightly modify it so that you can still lexically
scope the array to that sub:

Ok, that answers the question.

I'm refactoring a certain bottleneck, and looking for the dumbest tiniest improvements I can make in this one package. There's a ton of slowness from DB hits that I simply can't speed up anymore
If your database has already be tuned and you think you can nolonger go in deep to gain speed (modify schema, add indexes, tuned memory, partitioning,etc...), think about MemCache.
( already tossed software & my entire budget for hardware at it
) , and repeated cyrptographic functions ( which have been moved to xs and c ) -- so if I can't squeeze something stupid out of Perl on this one page, I'd be happy.

This brings up another point...

does anyone know about memory allocation with eval and closures ?

are these essentially the same?

my  $a= 10;

vs.

eval {
    my $a= 10;
}

or is new memory allocated each time for the var in eval ?



// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|      FindMeOn.com - The cure for Multiple Web Personality Disorder
|      Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|      RoadSound.com - Tools For Bands, Stuff For Fans
|      Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




Reply via email to