From 08b269d172acc2b4cb9b9336e2cd8097d89ef6a7 Mon Sep 17 00:00:00 2001 From: Naïm Favier Date: Sun, 2 Jun 2024 15:31:33 +0200 Subject: cache stat(2) calls When the user requests sorting by size or mtime, do a "soft preload" of the file list that only calls stat(2) without loading images. This avoids calling stat(2) repeatedly on the same files when sorting the file list, and achieves faster startup on slow filesystems. --- src/menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/menu.c') diff --git a/src/menu.c b/src/menu.c index b1ef61d..9c20692 100644 --- a/src/menu.c +++ b/src/menu.c @@ -835,7 +835,7 @@ void feh_menu_draw_submenu_at(int x, int y, Imlib_Image dst, int ox, int oy) for (int i= 0; i <= 3; i++) { imlib_image_draw_line(x+i, y+3+i, x+i, y+9-i, 0); } - + return; } @@ -1401,7 +1401,7 @@ static feh_menu *feh_menu_func_gen_info(feh_menu * m) if (!file->info) feh_file_info_load(file, im); if (file->info) { - snprintf(buffer, sizeof(buffer), "Size: %dKb", file->info->size / 1024); + snprintf(buffer, sizeof(buffer), "Size: %dKb", file->size / 1024); feh_menu_add_entry(mm, buffer, NULL, 0, 0, NULL); snprintf(buffer, sizeof(buffer), "Dimensions: %dx%d", file->info->width, file->info->height); feh_menu_add_entry(mm, buffer, NULL, 0, 0, NULL); -- cgit v1.2.3