On 5/24/05, Guohong Hu wrote:
>  
> Hi, I am reading a text file (XML) and for each chunk of the file content, I
> run a subroutine (sub1) to analyze it. A problem I met is after a certain
> point of the input file (for example, after chunk #100), the sub1 suddenly
> gets significantly slower. 
>   
> It seems not a memory problem, because in sub1 I only do 1) read but not
> modify some global hashes and arrays 2) read the file chunk content, and use
> some private variables to analyze it, then print out the results. So sub1 is
> not loading anything into the memory after exit. 
>   

You're asking a very general question. Without access to some code and
data that causes the problem, there is no way anyone can give you
specific suggestions. The problem could be in your code, the modules
you use, or simply the interaction of the code and specific data you
are reading (e.g. some feature of the data after chunk #100 that
causes the slowdown).

For one thing, you say "the sub1 suddenly gets significantly slower".
How do you know this?
Have you run Devel::DProf or some other benchmarking or profiling code?

Try to use Devel::ebug or the Perl debugger to help you pin-point the
problem. Write a test-case with minimal code and data that shows the
problem, and post that to this list. Then maybe someone can help :)

HTH,
-- 
Offer Kaye

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to