Optimization of Perl code 
Author Message
 Optimization of Perl code

Quote:

> I'm looking for literature / advises for optimizing my Perl scripts. The
> reason: I've written a little program which handles a large array (about
> 10 MB of data) and has to process each row of this array. The memory
> consumption is very high - more than 40 MB (I checked this from "top"
> output - high means for a computer that has only 64 MB RAM). Which
> common advises have you about this fact?

Don't read the whole array into memory at once.

Perl is a memory hog; it will often consume several times your data size
in memory due to its internal data structures tracking things like integer
forms, string lengths, and the like.  It's optimized for speed, not for
memory consumption, so if you're processing large data sets, you really
want to try to handle them a piece at a time.

--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker





Sat, 22 Feb 2003 09:01:02 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Delphi Review - New Reviews Posted!

2. Serious Bug in Delphi 2.0 Local Transactions ? - bug1.zip (0/1)

3. keypressed problem

4. HELP!!! Need help on installing DAO 3.0 in the registry!!!

5. code optimization and readability

6. Optimization of the code - suggestions?

7. Code optimization request and i18n issues

8. Code Optimization-- Can I do this better?

9. Code Optimization-- Can I do this better?

10. Code optimization: Anyone got a few spare minutes?

11. Optimization of date calculation code

12. possible perl optimizations

 

 
Powered by phpBB® Forum Software