dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: file read/write code
From: Björn Stenberg (
Date: 2002-11-08

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.


Page was last modified "Jan 10 2012" The Rockbox Crew