Skip to content

Commit b7cd589

Browse files
committed
Reduce max number of default parallel threads to 4
Parallel processing is used only when indexes are created and in the second processing stage of updates. In both cases the number of parallel threads should not be too high. Indexing requires a lot of memory and having too many in parallel running actually slows down the process. Updates are generally run in parallel with other load (like rendering) and should therefore also not take up too many CPUs. Fixes #885.
1 parent 9d1e4f3 commit b7cd589

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

options.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define basename /*SKIP IT*/
99
#endif
1010
#include <boost/format.hpp>
11+
#include <algorithm>
1112
#include <cstdio>
1213
#include <cstring>
1314
#include <osmium/version.hpp>
@@ -299,7 +300,7 @@ options_t::options_t()
299300
output_backend("pgsql"), input_reader("auto"), bbox(boost::none),
300301
extra_attributes(false), verbose(false)
301302
{
302-
num_procs = std::thread::hardware_concurrency();
303+
num_procs = (int) std::min(4U, std::thread::hardware_concurrency());
303304
if (num_procs < 1) {
304305
fprintf(stderr, "WARNING: unable to detect number of hardware threads supported!\n");
305306
num_procs = 1;

0 commit comments

Comments
 (0)