You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Gerald Richter <ri...@ecos.de> on 2002/07/01 20:16:21 UTC

Re: slow hashes with recursive loops?

Hi,
>
> I made a function to sort a folder list (with childs/parents), I know it
must be a silly method I use but it was the only one I could think of at the
time.
> The problem I now have is that is is very slow. I only have 128 folders
but it takes like 5 secs to loop through this.
>
> I have narrowed it down to the function below and I do not see the resaon
why it would be sooooooooooooooo slow.

Also I don't quite understand what you are doing here, it seems that you are
doing many many time the same sort, while the aruments to sort doesn't
change. At least I can't see in your code where you change %parentlist or
%node. So the first thing to do is to move these sort out of the loop and
perform them _before_ the loop, save the result in a array and use this as
argument to foreach. This should speed up your code many times (unless I
have overseen something). Maybe there are more constant operation that could
be moved out of the loop. Since I have to less knowlegde of your
datastructure, I can't say if there are more optimaziation possible.

> Then I remebered I read something about a bug or problem with embperl 2.x
and hashes. I cannot find it anymore but I use embperl 1.3b5 on redhat 7.2
(but same on redhat 6.1)
>

That has nothing to do with Perl hash. That was about some hashs that
Embperl 2 uses internaly and that only occurs if you have very huge
iteration of the same html code.

BTW. If you are using 1.3b5 I would recommend to update 1.3.4, but that's up
to you and has nothing to do with you problem.

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org