Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Why do we need to close filehandles?

by sundialsvc4 (Abbot)
on May 01, 2011 at 15:51 UTC ( [id://902353]=note: print w/replies, xml ) Need Help??


in reply to Re: Why do we need to close filehandles?
in thread Why do we need to close filehandles?

As a complete “aside point,” I normally do not ask my applications to “flush buffered data to disc.”   If you want to see just how badly this can affect performance (albeit with a perfectly good reason in this case), try using an SQLite database without using transactions.   Just let the data sit in the operating-system buffers as it normally does, and basically just let the OS do its thing.   But, when you have reached a logical end-point in whatever it is that you are doing, explicitly inform the operating system that you have done so, by closing the file.

Writes to things like flash-cards can be astonishingly slow, continuing for many seconds after the application has closed.   That is why it is paramount to drill-in to your users that they must dismount the cards, and wait for that process to finish, before removing the cards from the USB port.   (You’ve got maybe a 50% chance that your grandmother will actually listen to you, but maybe that’s better than nothing.)

Replies are listed 'Best First'.
Re^3: Why do we need to close filehandles?
by Anonymous Monk on May 01, 2011 at 20:58 UTC

    Or wait for the light on the device to change state, like an old school floppy drive.

    But that's not 100% guaranteed.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://902353]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-26 03:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found