Reduce attribute accumulation memory consumption (#318)

* Add a flag to use an H3 index for the feature index

* Give mvt_value and serial_val a double-with-count concept

* Switch mean over to internal accumulation state

* Get rid of the attribute accumulation map

* Change vectors of features to vectors of pointers to features

* Fix --coalesce

* Revert "Add a flag to use an H3 index for the feature index"

This reverts commit b9b48f42c9.

* Update version and changelog
This commit is contained in:
Erica Fischer
2025-01-30 21:58:35 -08:00
committed by GitHub
parent 390c362452
commit 583fc3744a
11 changed files with 243 additions and 232 deletions
+14 -1
View File
@@ -70,6 +70,20 @@ struct serial_val {
type = mvt_string;
s = val;
}
size_t get_count() const {
size_t found = s.find('\0');
if (found == std::string::npos) {
return 0;
} else {
return atoll(s.c_str() + found + 1);
}
}
void set_double_count(double v, size_t c) {
type = mvt_double;
s = milo::dtoa_milo(v) + '\0' + std::to_string(c);
}
};
struct key_pool {
@@ -152,7 +166,6 @@ struct serial_feature {
const char *stringpool; // string pool for keys/values lookup
std::shared_ptr<std::string> tile_stringpool; // string pool for mvt_value construction
std::set<std::string> need_tilestats;
std::unordered_map<std::string, accum_state> attribute_accum_state;
int z; // tile being produced
int tx;