| Summary: | create 'get best number of threads' API in sal | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Michael Meeks <michael.meeks> |
| Component: | LibreOffice | Assignee: | Not Assigned <libreoffice-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | michael.meeks, sberg.fun |
| Priority: | medium | Keywords: | difficultyBeginner, easyHack, skillCpp, topicCleanup |
| Version: | 4.2.0.0.alpha0+ Master | ||
| Hardware: | Other | ||
| OS: | All | ||
| Whiteboard: | |||
| Crash report or crash signature: | Regression By: | ||
can we directly use Boost's approximation of C++11 std::thread::hardware_concurrency for that, see <http://www.boost.org/doc/libs/1_55_0/doc/html/thread/thread_management.html#thread.thread_management.thread.hardware_concurrency>? I guess that means linking to and/or distributing boost's thread library (?) or is that method effectively in-lined ? Either way - given that as we start to use more threading anyway, having boost threads around would be rather helpful - it'd be great to have that usable. It seems we have StaticLibrary_boostthread - but ... do we link it anywhere already ? or ... 'git grep boost/thread' seems to show nothing =) Since we allow C++11 now, we could use std::thread::hardware_concurrency directly. However, do we even need a API wrapper for this as this is standard C++11? @Michael: Also there is already a comphelper::ThreadPool wrapper, do we need another one? All good points; lets just close this now - we are using the std:: API currently. Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup) [NinjaEdit] Remove LibreOffice Dev List from CC on EasyHacks (curtailing excessive email to list) [NinjaEdit] |
A reasonably simple easy hack to add an API to fetch an optimal number of threads (presumably the same as the core count usually ;) That is needed to setup optimal parallelism in calc XLSX loading eg. See: sc/source/filter/oox/workbookfragment.cxx sal_Int32 nThreads = std::min( rSheets.size(), (size_t) 4 /* FIXME: ncpus/2 */ ); Notice the '4' ;-) not ideal - clearly. The API should live inside sal/osl/ and include/osl/ and just wrap thinly the underlying OS parameters without being hyper-complicated.