Develop the background loader

Bug #733117 reported by Marco Lazzaroni
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Luce Image Viewer
Confirmed
High
Marco Lazzaroni

Bug Description

At the moment Luce preloads all the images to RAM. This is not a workable solution. The following algorithm runs a "mobile" cache around the current image:

http://luceimageviewer.wordpress.com/2011/03/10/the-background-loader-algorithm/

int N = number of image;
int cur = pointer to current image;
bool going_forward = current direction
int max_memory = maximum memory for luce
int cur_memory = current used memory
bool async_load = do async/sync load

flag_loadable_neighbours(cur_memory, max_memory);
next=cur;
prev=cur;
for(i=0;i<N/2;i++)
{
    async_load=!i;
    if(!ThumbIsLoaded(next) && ThumbIsLoadable(next) && !ThumbIsLoading(next))
        LoadThumb(next,async_load);
    async_load=1;
    if(!ScreenIsLoaded(next) && ScreenIsLoadable(next) && !ScreenIsLoading(next))
        LoadScreen(next,async_load);
    if(!ThumbIsLoaded(prev) && ThumbIsLoadable(prev) && !ThumbIsLoading(prev))
        LoadThumb(next,async_load);
    if(NeedToBreak())
        break; //usually triggered by a keypress
    if(going_forward())
        next=cur->next; prev=cur->prev;
    else
        next=cur->prev; prev=cur->next;
}

Changed in luce:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Marco Lazzaroni (marcolazzaroni)
milestone: none → 0.0.3
Revision history for this message
Marco Lazzaroni (marcolazzaroni) wrote :

Probably, only the the thumb with i=0 must be synchronous, the others asynchronous

description: updated
Changed in luce:
milestone: 0.0.3 → 0.0.4
Revision history for this message
Marco Lazzaroni (marcolazzaroni) wrote :

max_memory will be a part of system memory.
After a research, the /usr/bin/free utility of the procps package parses the content of the /proc/meminfo file.
It would be nice to dinamically shape max_memory in order not to overload the system, in the case that heavy processes are open when luce is already running.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.