That was a problem I was thinking of. It seems pretty fast (although I am
trying it with a 5MB file on a TX, so it'll be a bit slow). The thing I was
concerned with was it would have 3Kb left to read, so I tell FileRead to
read 1 block of 4096, then FileRead returns 0. So then, how would I figure
out how much FileRead read (sounds way too redundant). I just decided that
performance probably would not bu hit if I told FileRead to read 4069 blocks
of 1 byte.

My guess is that it is no different then doing:

totalSize = numBlocks * blockSize;

for (i=0; i < totalSize; i++) {
  outbufBuf[i] = inBuf[i];
}

or:

for (i=0; i < numBlocks; i++) {
    for (j=0; j < blockSize; j++) {
        outBuf[i+j] = inBuf[i+j]; // or something like this, you get the
idea...
    }
}

The only reason I think that there is a performance hit is that the TX has
to copy the 5MB file over to the DB Cache. I did notice that just before I
open it the device slows down really badly (after I call the FileClose to
close it after the HTTP engine has written to it). So my guess is that any
performance loss comes from moving the file from DB Cache to NVFS, from NVFS
to DB Cache and then from DB Cache to the card, and then back from DB Cache
to NVFS.

I tested the code with the 5MB Intel DUo Mac Processor add. Code worked
flawlessly.

Just to check, file streams are stored in DB Cache when being worked with,
correct?

Thanks again for all of the help,
Donald


"Henk Jonas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Adrien Regimbald wrote:
>
> > Hello Donald,
> >
> > Perhaps you're not worried about performance, but wouldn't reading
> > 4096 1 byte blocks be substantially slower than reading 1 4096 byte
> > block? You just need to do a bit of extra arithmetic to turn the
> > number of blocks read from FileRead into number of bytes read.
> >
> > Adrien.
> >
>
> I don't think it's slower as I belive it is a relict from old times...
> Nowadays, IMHO both values are multiplied together and then the
> resulting bytes are read. And, if you do it the other way around and it
> returns 0, what does it mean? 0 bytes read or anything between 0 and
> 4095? If you need to know how much you've read, you need to use a
> blocksize of 1.
>
> Regards
> Henk
>
> --
> -------------------------------------------------------------------------
>    Henk Jonas                                            [EMAIL PROTECTED]
>    Palm OS ® certified developer
>
>    Please contact me, if you need an off-site contract worker.
> -------------------------------------------------------------------------
>



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to