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
 Adaptive ThreadPoolSize?

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
PeterPanino Posted - Jan 05 2017 : 12:43:20
What happens if I set TImageEnMView.ThreadPoolSize := 10 and a user has only two CPU cores in his computer?

Is there some kind of Adaptive ThreadPoolSize functionality which automatically adjusts the value of ThreadPoolSize to the user's hardware?
8   L A T E S T    R E P L I E S    (Newest First)
nwscomps Posted - Jan 06 2017 : 15:30:13
Peter, I have answered to your message from the contact form. (also now the redirect in the contact form should be fixed)

About the first question, I have replied in the email.
About the internet urls they are read in multithreading, but the list of urls must be provided by the user.


Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
PeterPanino Posted - Jan 06 2017 : 12:07:53
Francesco, since the contact form on your website does not work:

What I would also need: Does ThumbsBrowser support creating thumbs from web pages (in a multi-threading mode)? For example, I would provide a list of web-page URLs and ThumbsBrowser is filled with the thumbs of those web pages.
PeterPanino Posted - Jan 06 2017 : 11:34:55
From what I read on your website, your ThumbsBrowser component looks very interesting. When it "adds thumbnails from memory", is this done in multi-threading mode? Can I add thumbnail-bitmaps to a FIFO multi-bitmap-buffer provided by my own routine and your component takes them out from the buffer and adds them to the Thumbsbrowser in multi-threading mode?
nwscomps Posted - Jan 06 2017 : 08:37:54
Peter, for normal usage I would recommend something like this formula:

PoolSize := max(5, min(12, NCpu * 2 -1));

This with optimal cpu usage by windows would typically load a couple of threads per cpu, reserving extra cpu power for all the rest.

I would put a higher limit on the number of threads, because if the files that are being loaded require too much cpu (like in my tests raw files), you can have the threads drain all the cpu power.

PS my tests are based on my ThumbsBrowser component, not on TImageenmview, but since I expect the loading mechanism to be somewhat similar, it can be applied to TImageenmview as well.
In Thumbsbrowser you have another variable called MultithreadTimeout that is number of millisecs to wait before creating extra threads if the threads in the pool do not complete the job in the allocated time. This can allocate a number of extra threads if thumbnails are too slow to load like in the mentioned raw files test, in order to display eventually those thumbs that are faster to load. In this scenario there is an internal check on the maximum amount of extra threads not to be exceeded.

Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
PeterPanino Posted - Jan 06 2017 : 06:28:47
Thank you, Nigel. So what is the suggested ThreadPoolSize value? Are there any circumstances which influence this decision? Or can I set the ThreadPoolSize value to literally ANY value independently from the user's hardware?
xequte Posted - Jan 05 2017 : 17:10:34
Hi Peter

ImageEn is not specifically targeting the CPU cores, other than what is done by Windows itself, so I doubt there is particular benefit from correlating ThreadPoolSize to number of processors.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
PeterPanino Posted - Jan 05 2017 : 15:54:53
Thank you, Francesco.

But what happens if I set TImageEnMView.ThreadPoolSize := 10 and a user has only two CPU cores in his computer?

And should always ThreadPoolSize := NumberOfProcessors * 2?
nwscomps Posted - Jan 05 2017 : 15:35:56
Hello Peter,
to know the number of cpus you can use:

function NumberOfProcessors: Integer;
var
    systemInfo: SYSTEM_INFO;
begin
    GetSystemInfo(systemInfo);
    Result := systemInfo.dwNumberOfProcessors;
end;




Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library