Open jwinarske opened 11 months ago
30 threads is not that high. What problem is this causing? These threads should only be busy in small bursts.
Add in the Flutter Engine and I have 87 threads under my process. On a mobile device it will be limited to the max core count; which might be eight... Debugging is slower than it should be.
And what's the CPU usage of those threads?
Once it gets running the majority are blocked waiting for a message.
I patched my tree in Filament and the Flutter engine to go from 87 to a more reasonable 32 threads. Flutter Engine has the same issue.
/squanderer-in-chief
@jwinarske can you please explain the logic in your sample code, I don't understand what's going on:
req
. Why? e.g. if req is 12 and std::thread::hardware_concurrency
returns 4, then we would return 12???if
, why?In the comment you talk about a "scaled value", what does that mean?
why should we treat odd/even differently from hardware_concurrency
?
@pixelflinger Hi there. Sorry that was half baked; related to something else. I just updated my proposed fix
⚠️ Issues not using this template will be systematically closed.
Describe the bug Development machines with large core count spawn too many threads.
std::thread::hardware_concurrency()
may return the hardware thread count of available hardware threads. In general this is not handled in the most ideal way to prevent excessive resource consumption. This will impact debugging performance on a host machineSample source tree grep for
std::thread::hardware_concurrency()
:On my dev box it has 32 hardware threads. That means the engine is spawning 30 threads.
To Reproduce Steps to reproduce the behavior:
Expected behavior Not to impact debugging performance or consume excessive resources.
Logs If applicable, copy full logs from your console here. Please do not use screenshots of logs, copy them as text, use gist or attach an uncompressed file.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context A proposed solution might be: