mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Also use pread instead of mapping to read in the data to sort
This commit is contained in:
@@ -392,15 +392,10 @@ void *run_sort(void *v) {
|
|||||||
std::string s;
|
std::string s;
|
||||||
s.resize(end - start);
|
s.resize(end - start);
|
||||||
|
|
||||||
void *map = mmap(NULL, end - start, PROT_READ, MAP_PRIVATE, a->indexfd, start);
|
if (pread(a->indexfd, (void *) s.c_str(), end - start, start) != end - start) {
|
||||||
if (map == MAP_FAILED) {
|
fprintf(stderr, "pread(index): %s\n", strerror(errno));
|
||||||
perror("mmap in run_sort");
|
exit(EXIT_READ);
|
||||||
exit(EXIT_MEMORY);
|
|
||||||
}
|
}
|
||||||
madvise(map, end - start, MADV_SEQUENTIAL);
|
|
||||||
madvise(map, end - start, MADV_WILLNEED);
|
|
||||||
memcpy((void *) s.c_str(), map, end - start);
|
|
||||||
munmap(map, end - start);
|
|
||||||
|
|
||||||
qsort((void *) s.c_str(), (end - start) / a->bytes, a->bytes, indexcmp);
|
qsort((void *) s.c_str(), (end - start) / a->bytes, a->bytes, indexcmp);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user