mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-03 08:55:41 +02:00
Check how many CPUs and filehandles there are instead of guessing
This commit is contained in:
@@ -818,7 +818,7 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
|
||||
struct task {
|
||||
int fileno;
|
||||
struct task *next;
|
||||
} tasks[TEMP_FILES];
|
||||
};
|
||||
|
||||
struct write_tile_args {
|
||||
struct task *tasks;
|
||||
@@ -961,9 +961,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
}
|
||||
}
|
||||
|
||||
#define MAX_THREADS 20 // XXX Obtain from sysctl(hw.ncpu), /proc/cpuinfo, etc.
|
||||
|
||||
int threads = MAX_THREADS;
|
||||
int threads = CPUS;
|
||||
if (threads > TEMP_FILES / 4) {
|
||||
threads = TEMP_FILES / 4;
|
||||
}
|
||||
@@ -978,6 +976,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
||||
|
||||
// Assign temporary files to threads
|
||||
|
||||
struct task tasks[TEMP_FILES];
|
||||
struct dispatch {
|
||||
struct task *tasks;
|
||||
long long todo;
|
||||
|
||||
Reference in New Issue
Block a user