Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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?
erix .oO( note to self: running 100 syncing database instances on a single machine is hard on the hard disks )
[1nickt]: Oh, no, sins of the flesh were *especially* verboten at that monastery!

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2017-12-13 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (367 votes). Check out past polls.

    Notices?