Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Performance Trap - Opening/Closing Files Inside a Loop

by sgifford (Prior)
on Dec 10, 2004 at 00:14 UTC ( #413724=note: print w/replies, xml ) Need Help??


in reply to Performance Trap - Opening/Closing Files Inside a Loop

Unless the Java programmer knows something you don't (like there are only 100 possibilities for filenames), I don't think their performance will beat an implementation that caches filehandles, as you described in your second example. I don't even think a C or Assembly program would be much faster; IMHO the time will be completely dominated by I/O and system calls.

One trick to be able to keep many filehandles open without worrying about consuming more resources than you intend to is the FileCache module.

  • Comment on Re: Performance Trap - Opening/Closing Files Inside a Loop

Replies are listed 'Best First'.
Re^2: Performance Trap - Opening/Closing Files Inside a Loop
by Limbic~Region (Chancellor) on Dec 10, 2004 at 00:27 UTC
    sgifford,
    like there are only 100 possibilities for filenames

    And what they are so they can be opened before entering the loop. This isn't the case.


    Cheers - L~R

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://413724]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2018-06-23 11:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (125 votes). Check out past polls.

    Notices?