Page MenuHome

T90908: Reduce loading times when extracting thumbnails from Blendfiles.
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Aug 25 2021, 11:04 AM.

Details

Summary

Previously when loading an thumbnails for an asset the whole file was
read. Reason this was done was perhaps a future idea to load
all thumbnails inside a blendfile in a single go. This was never implemented
and currently unneeded disk and cpu cycles was spend with finding out what
preview to load.

This patch adds an early break when the thumbnail that the caller is
interested in has been found. This improves the thumbnail extraction
when looking into large files.

Diff Detail

Repository
rB Blender

Event Timeline

  • Shuffled code to reduce the number of unclear exist.
Jeroen Bakker (jbakker) requested review of this revision.Aug 25 2021, 11:21 AM
Jeroen Bakker (jbakker) retitled this revision from Partial T90908: Reduce full fill read when loading thumbnails. to T90908: Reduce loading times when extracting thumbnails from Blendfiles..
  • Renamed to BLO_blendhandle_get_preview_for_id
Jeroen Bakker (jbakker) planned changes to this revision.Aug 25 2021, 11:56 AM
Jeroen Bakker (jbakker) added inline comments.
source/blender/blenloader/BLO_readfile.h
174

We should keep the old implementation as I am tempted to redoing the thumbcache.

  • Reverted back the old behavior and added the new behavior next to it.
Bastien Montagne (mont29) requested changes to this revision.Aug 25 2021, 12:42 PM

Generally LGTM, just really think the loop over preview indices (for the different sizes) should be part of the helper reading func.

source/blender/blenloader/intern/readblenentry.c
225–231

This is very confusing, and a nice source of bugs, since signature of the function hints that it can randomly access a given preview_index, when this code can only even work once and with proper sequential preview_index.

The loop over preview_index values should be done in this helper. And comment should make it clears that the bhead is 'consumed' too.

268

preview_from_file == NULL

This revision now requires changes to proceed.Aug 25 2021, 12:42 PM
  • Moved forloop into helper function.
Jeroen Bakker (jbakker) marked 2 inline comments as done.Aug 25 2021, 2:16 PM
This revision is now accepted and ready to land.Aug 25 2021, 3:09 PM