Jump to content

Optmal Buffer Size while using FileRead?


tip
 Share

Recommended Posts

Hi all,

I'm a newbie and if this is a silly question please be patient with me ^_^...

I was wondering how the buffer effects softwares... For ex. when we try to calculate MD5 hash of a large file we divide it to smaller pieces during FileRead.

for $i to ceiling($Filesize/0x20000)
      FileRead($OpenedFilesHandle,0x20000)
next

I'm not sure that "0x20000" can be called "Buffer" though I was wondering what effect it has on the script.

I tried to set it a higher value like 0x80000 but I couldn't noticed any difference while it was running.

So if you can help me figuring it out I'd be very content.

Thanks in advance

Edited by tip

[center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center]

Link to comment
Share on other sites

Read the CreateFile API function description and remarks you'll have a clue what buffering is good for and in which cases. Generally, if you're going to parse (copy) big files, more than a few mbs, you'll see a performance issues and maybe allocation failures if the file is above a few tens of mbs. It'll undermine your program stability as well as the system available memory. If you're going to develop things as "minimum required 512 MB RAM and recommended 2 GB RAM" you'll need to adopt buffering and determine when to use it, and when buffering is not required.

Edited by Authenticity
Link to comment
Share on other sites

So that "0x20000" has nothing to do with "buffer" right? You are saying buffer is something completely different.. Because when I calculate MD5 Hash with that line it consumes only 6MB of ram...

[center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...