ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnMView - Lots of thumbnails (~300) and speed.

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
cpstevenc Posted - Nov 22 2022 : 10:48:43
Using Delphi 11.2 - win32
ImageEN - v11.4.0

Working with lots of "emotes" PNG files.

Almost 900 of them. Split between three

112x112 , 56x56, 28x28

If only A few , speed seems fine.

But once I populate everything, speed takes A hit when navigating.

You can see blank spots for a while until it populates.

I've tried using DiskCache and ImageCacheUseDisk with 300 limit. Which is 3 more than what I have available.

This doesn't speed anything up it seems? PLUS it makes the images bad.

Bad as in duplicated over and over.

If I clear the cache and repopulate, same issues.

1st image, Duplicates with the DisCache and ImageCacheUseDisk. Maybe issue of settings, or using both? not sure.




2nd image, Navigating, blank images for 5+ seconds until they populate.



3rd image, can see 2nd list, duplicated over and over. 3rd image list, the UI is all kinds of messed up.




I have played with ThumbnailResampleFilter to currently rfWICLinear... going for speed over quality. Which I can't tell any difference in either.

So currently now.... DiskCache / ImageCache turned off as doesn't seem to help currently, and clobbers / duplicates.

Basically , like to get these populate as fast as possible, and reduce / remove the issue of thumbnails missing for a few seconds while they populate/draw in when navigating.



5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 23 2022 : 15:07:48
Whoops sorry, DiskCacheAlgorithm is not available until 11.4.5, which should be out next week.

Nigel
Xequte Software
www.imageen.com
cpstevenc Posted - Nov 23 2022 : 10:52:50
Thanks I'll check this out!

I used a thread, because my current app code has A thread, to download images from a web server and does some other work while populating. The images could be added/removed/ect .. so I won't be just loading from a folder like in the example.

So it was quite a bit simplified for this, but wanted it A thread for this at least to show that I was doing work in a thread.

Anyways

DiskCacheAlgorithm

Where is this? I don't see this in the ImageEn Source.

for idx := 0 to self.ComponentCount - 1 do
  begin
    if self.Components[idx] is TImageEnMView then
    begin
      (Components[idx] as TImageEnMView).DiskCache.Folder := Extractfilepath(application.ExeName) + '\cache\' +
        Components[idx].Name;
      (Components[idx] as TImageEnMView).DiskCache.MinWidth := 5;
      (Components[idx] as TImageEnMView).DiskCache.MinHeight := 5;
      (Components[idx] as TImageEnMView).DiskCache.Enabled := true;
      (Components[idx] as TImageEnMView).MaintainInvisibleImages := -1;
      (Components[idx] as TImageEnMView).StoreType := ietthumb;
    end;
  end;


I did this on my app startup... and it's working extremely well now!

Thanks!


xequte Posted - Nov 22 2022 : 23:01:39
OK, so there were some performance issues with the app..

Disk caching...

Firstly, set this which works better where filenames are closely matched:

  DiskCacheAlgorithm := -$00008004;

Secondly, you need to use a unique folder for your caching, e.g.

    imageListG4.DiskCache.Folder :=  'D:\emotetest\cache1';
    imageListG2.DiskCache.Folder :=  'D:\emotetest\cache2';
    imageListG1.DiskCache.Folder :=  'D:\emotetest\cache3';

In my testing that gives very good performance (after the initial caching).


Actual vs on-demand filling...

You are filling the content at startup, so ensure that you do not discard any images just because they are not visible:

  imageListG4.MaintainInvisibleImages := -1;
  imageListG2.MaintainInvisibleImages := -1;
  imageListG1.MaintainInvisibleImages := -1;
  imageListG4.StoreType := ietThumb;
  imageListG2.StoreType := ietThumb;
  imageListG1.StoreType := ietThumb;



Your Threaded fill...

You use a thread to fill the content, which is unnecessary as ImageEn will do that for you.

If you are using disk caching, you will get much better responsiveness by just performing a regular fill...

procedure TForm1.PopulateImages();
var
  files: TStringDynArray;
  filename: string;
begin
  imageListG4.StoreType := ietThumb;
  imageListG2.StoreType := ietThumb;
  imageListG1.StoreType := ietThumb;  

  imageListG4.MaintainInvisibleImages := -1;
  imageListG2.MaintainInvisibleImages := -1;
  imageListG1.MaintainInvisibleImages := -1;

  imageListG4.LockPaint;
  imageListG2.LockPaint;
  imageListG1.LockPaint;
  try
    files := TDirectory.GetFiles(FEmoteFolder, '*.png', TSearchOption.soAllDirectories);
    for filename in files do
    begin
      if pos('.1.0.png', filename) > 0 then
        imageListG1.AppendImage(filename);

      if pos('.2.0.png', filename) > 0 then
        imageListG2.AppendImage(filename);

      if pos('.3.0.png', filename) > 0 then
        imageListG4.AppendImage(filename);
    end;

  finally
    imageListG4.SelectImage(0);
    imageListG4.UnlockPaint;
    imageListG2.UnlockPaint;
    imageListG1.UnlockPaint;
  end;
end;


But I prefer loading on demand...

...
    files := TDirectory.GetFiles(FEmoteFolder, '*.png', TSearchOption.soAllDirectories);
    for filename in files do
    begin
      if pos('.1.0.png', filename) > 0 then
        imageListG1.AppendImage(filename + IEM_Path_Index_Delimiter + '[0]' );

      if pos('.2.0.png', filename) > 0 then
        imageListG2.AppendImage(filename + IEM_Path_Index_Delimiter + '[0]' );

      if pos('.3.0.png', filename) > 0 then
        imageListG4.AppendImage(filename + IEM_Path_Index_Delimiter + '[0]' );
    end;
...



Also try the demo:

\Demos\Multi\MViewPerformance\Performance.dpr

Nigel
Xequte Software
www.imageen.com
cpstevenc Posted - Nov 22 2022 : 20:56:38
Emailed it but attached it here too.

Slimed down to the bare code needed.



attach/cpstevenc/20221122205046_emotetest.zip
5924.05 KB
xequte Posted - Nov 22 2022 : 18:55:24
Hmmm, it's hard to see any reason for performance issues there. Can you please email me your test application.

Nigel
Xequte Software
www.imageen.com