Rockbox mail archiveSubject: Re: file read/write code
Re: file read/write code
From: Björn Stenberg <bjorn_at_haxx.se>
Date: Fri, 8 Nov 2002 17:38:00 +0100
Greg Haerr wrote:
> Let me know what you think of this.
Correct me if I'm wrong, but it looks like you sacrify 50% transfer speed for simpler code.
Your code buffers all sectors. That's what makes it simple - read() does not need to bother about which sectors are cached and not. It just memcpies everything. The penalty is harsh, though. Your code copies every byte twice (disk->buffer, buffer->target), while the current code only copies once (disk->target, except for head and tail bytes).
Is there a simple way around this that I don't see?
> Take a look at the gcc -S output and you'll see huge differences
> with code speed and size when an unsigned divide or modulo
> is computed, versus a signed divide/modulo.
Thanks for the heads-up. Although I prefer to use unsigned int rather than long.
-- BjörnReceived on 2002-11-08