Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: max 200 entries in a dir. why?
From: Björn Stenberg (bjorn_at_haxx.se)
Date: 2002-08-13


John Wood wrote:
> Why exactly? Memory fragmentation? Performance?

Because it's useless.

Dynamic memory is only ever useful if you have memory consumers (tasks) that run at different points in time, and thus can reuse the same memory for different purposes. We don't have that. We must be able to show a big dir, index a big playlist and play a big mp3 file, all at the same time. They cannot use the same memory, and thus dynamic memory buys us nothing but extra complexity.

If we used dynamic memory for this, we would get all kinds of odd bugs. Playlists that only got half-loaded if placed in certain directories. Parts of the disk you couldn't go to if playing a certain playlist etc.

We have a number of tasks that consume memory. They can all run at the same time, using all of their alotted memory. Therefore it is much better to allocate that memory to them beforehand and not pretend that anyone else is able to use it. This is standard practice in memory-limited systems.

> It would have been better to implement directory caching the same way
> playlists are implemented -- one buffer for the filenames (dynamically
> sized), another for the sorted index array. That's the only reason we can
> get 10,000 playlist items right?

There's a world of difference between playlists and directories:
- Playlists are accessed one line every few minutes, dirs all at once
- Playlists are not sorted, dirs are

This is my last response in this issue. I haven't seen anyone come up with a single reason *why* we should support huge dirs, only half-baked ideas for unworking kludges.

I'll be over there writing code. You guys have fun.

-- 
Björn



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