Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@
path = extern/KTX-Software
url = https://github.com/CesiumGS/KTX-Software.git
branch = cesium-native
[submodule "extern/parallel-hashmap"]
path = extern/parallel-hashmap
url = https://github.com/greg7mdp/parallel-hashmap
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log


### ? - ?

##### Additions :tada:

- Replaced std::unordered\_map with [Parallel Hashmap](https://github.com/greg7mdp/parallel-hashmap) for better performance.

### v0.18.1 - 2022-08-04

##### Fixes :wrench:
Expand Down
5 changes: 3 additions & 2 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Class.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

#include <CesiumUtility/ExtensibleObject.h>

#include <parallel_hashmap/phmap.h>

#include <optional>
#include <string>
#include <unordered_map>

namespace Cesium3DTiles {
/**
Expand All @@ -33,6 +34,6 @@ struct CESIUM3DTILES_API Class final : public CesiumUtility::ExtensibleObject {
* object defining the property. Property IDs shall be alphanumeric
* identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.
*/
std::unordered_map<std::string, Cesium3DTiles::ClassProperty> properties;
phmap::flat_hash_map<std::string, Cesium3DTiles::ClassProperty> properties;
};
} // namespace Cesium3DTiles
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

#include <CesiumUtility/ExtensibleObject.h>

#include <parallel_hashmap/phmap.h>

#include <cstdint>
#include <optional>
#include <unordered_map>

namespace Cesium3DTiles {
/**
Expand All @@ -29,6 +30,7 @@ struct CESIUM3DTILES_API ClassStatistics final
* class' `properties` dictionary and each value is an object containing
* statistics about property values.
*/
std::unordered_map<std::string, Cesium3DTiles::PropertyStatistics> properties;
phmap::flat_hash_map<std::string, Cesium3DTiles::PropertyStatistics>
properties;
};
} // namespace Cesium3DTiles
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#include <CesiumUtility/ExtensibleObject.h>
#include <CesiumUtility/JsonValue.h>

#include <parallel_hashmap/phmap.h>

#include <string>
#include <unordered_map>

namespace Cesium3DTiles {
/**
Expand All @@ -35,6 +36,6 @@ struct CESIUM3DTILES_API MetadataEntity
* values matching the `componentType`. Required properties shall be included
* in this dictionary.
*/
std::unordered_map<std::string, CesiumUtility::JsonValue> properties;
phmap::flat_hash_map<std::string, CesiumUtility::JsonValue> properties;
};
} // namespace Cesium3DTiles
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#include <CesiumUtility/ExtensibleObject.h>
#include <CesiumUtility/JsonValue.h>

#include <parallel_hashmap/phmap.h>

#include <optional>
#include <unordered_map>

namespace Cesium3DTiles {
/**
Expand Down Expand Up @@ -80,6 +81,6 @@ struct CESIUM3DTILES_API PropertyStatistics final
* `type` is `ENUM`. For fixed-length arrays, this is an array of
* component-wise occurrences.
*/
std::unordered_map<std::string, CesiumUtility::JsonValue> occurrences;
phmap::flat_hash_map<std::string, CesiumUtility::JsonValue> occurrences;
};
} // namespace Cesium3DTiles
5 changes: 3 additions & 2 deletions Cesium3DTiles/generated/include/Cesium3DTiles/PropertyTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

#include <CesiumUtility/ExtensibleObject.h>

#include <parallel_hashmap/phmap.h>

#include <cstdint>
#include <optional>
#include <string>
#include <unordered_map>

namespace Cesium3DTiles {
/**
Expand Down Expand Up @@ -43,7 +44,7 @@ struct CESIUM3DTILES_API PropertyTable final
* property values are stored. Required properties shall be included in this
* dictionary.
*/
std::unordered_map<std::string, Cesium3DTiles::PropertyTableProperty>
phmap::flat_hash_map<std::string, Cesium3DTiles::PropertyTableProperty>
properties;
};
} // namespace Cesium3DTiles
7 changes: 4 additions & 3 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

#include <CesiumUtility/ExtensibleObject.h>

#include <parallel_hashmap/phmap.h>

#include <optional>
#include <string>
#include <unordered_map>

namespace Cesium3DTiles {
/**
Expand Down Expand Up @@ -45,13 +46,13 @@ struct CESIUM3DTILES_API Schema final : public CesiumUtility::ExtensibleObject {
* object defining the class. Class IDs shall be alphanumeric identifiers
* matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.
*/
std::unordered_map<std::string, Cesium3DTiles::Class> classes;
phmap::flat_hash_map<std::string, Cesium3DTiles::Class> classes;

/**
* @brief A dictionary, where each key is an enum ID and each value is an
* object defining the values for the enum. Enum IDs shall be alphanumeric
* identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.
*/
std::unordered_map<std::string, Cesium3DTiles::Enum> enums;
phmap::flat_hash_map<std::string, Cesium3DTiles::Enum> enums;
};
} // namespace Cesium3DTiles
4 changes: 2 additions & 2 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <CesiumUtility/ExtensibleObject.h>

#include <unordered_map>
#include <parallel_hashmap/phmap.h>

namespace Cesium3DTiles {
/**
Expand All @@ -22,6 +22,6 @@ struct CESIUM3DTILES_API Statistics final
* `classes` dictionary and each value is an object containing statistics
* about entities that conform to the class.
*/
std::unordered_map<std::string, Cesium3DTiles::ClassStatistics> classes;
phmap::flat_hash_map<std::string, Cesium3DTiles::ClassStatistics> classes;
};
} // namespace Cesium3DTiles
5 changes: 3 additions & 2 deletions Cesium3DTiles/generated/include/Cesium3DTiles/Tileset.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

#include <CesiumUtility/ExtensibleObject.h>

#include <parallel_hashmap/phmap.h>

#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

namespace Cesium3DTiles {
Expand All @@ -34,7 +35,7 @@ struct CESIUM3DTILES_API Tileset final
/**
* @brief A dictionary object of metadata about per-feature properties.
*/
std::unordered_map<std::string, Cesium3DTiles::Properties> properties;
phmap::flat_hash_map<std::string, Cesium3DTiles::Properties> properties;

/**
* @brief An object defining the structure of metadata classes and enums. When
Expand Down
1 change: 1 addition & 0 deletions Cesium3DTilesReader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ target_link_libraries(Cesium3DTilesReader
Cesium3DTiles
CesiumJsonReader
GSL
phmap
)

install(TARGETS Cesium3DTilesReader
Expand Down
18 changes: 18 additions & 0 deletions Cesium3DTilesReader/generated/src/GeneratedJsonHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ Extension3dTilesBoundingVolumeS2JsonHandler::readObjectKey(
*this->_pObject);
}

#if defined(__GNUC__) && __GNUC__ <= 10 && !defined(__clang__)
void Extension3dTilesBoundingVolumeS2JsonHandler::reset(
CesiumJsonReader::IJsonHandler* pParentHandler,
CesiumUtility::ExtensibleObject& o,
const std::string_view& extensionName) {
std::experimental::any& value =
o.extensions
.emplace(
extensionName,
Cesium3DTiles::Extension3dTilesBoundingVolumeS2())
.first->second;
this->reset(
pParentHandler,
&std::experimental::any_cast<
Cesium3DTiles::Extension3dTilesBoundingVolumeS2&>(value));
}
#else
void Extension3dTilesBoundingVolumeS2JsonHandler::reset(
CesiumJsonReader::IJsonHandler* pParentHandler,
CesiumUtility::ExtensibleObject& o,
Expand All @@ -47,6 +64,7 @@ void Extension3dTilesBoundingVolumeS2JsonHandler::reset(
pParentHandler,
&std::any_cast<Cesium3DTiles::Extension3dTilesBoundingVolumeS2&>(value));
}
#endif

CesiumJsonReader::IJsonHandler* Extension3dTilesBoundingVolumeS2JsonHandler::
readObjectKeyExtension3dTilesBoundingVolumeS2(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

namespace Cesium3DTilesReader {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

namespace Cesium3DTilesReader {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

namespace Cesium3DTilesReader {
Expand Down
1 change: 1 addition & 0 deletions Cesium3DTilesSelection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ target_link_libraries(Cesium3DTilesSelection
# PRIVATE
tinyxml2
uriparser
phmap
)

install(TARGETS Cesium3DTilesSelection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ static void createTestForScalarJson(
std::optional<Schema> schema = metadata->schema;
REQUIRE(schema != std::nullopt);

const std::unordered_map<std::string, Class>& classes = schema->classes;
const phmap::flat_hash_map<std::string, Class>& classes = schema->classes;
REQUIRE(classes.size() == 1);

const Class& defaultClass = classes.at("default");
const std::unordered_map<std::string, ClassProperty>& properties =
const phmap::flat_hash_map<std::string, ClassProperty>& properties =
defaultClass.properties;
REQUIRE(properties.size() == 1);

Expand Down Expand Up @@ -232,11 +232,11 @@ static void createTestForArrayJson(
std::optional<Schema> schema = metadata->schema;
REQUIRE(schema != std::nullopt);

const std::unordered_map<std::string, Class>& classes = schema->classes;
const phmap::flat_hash_map<std::string, Class>& classes = schema->classes;
REQUIRE(classes.size() == 1);

const Class& defaultClass = classes.at("default");
const std::unordered_map<std::string, ClassProperty>& properties =
const phmap::flat_hash_map<std::string, ClassProperty>& properties =
defaultClass.properties;
REQUIRE(properties.size() == 1);

Expand Down Expand Up @@ -485,11 +485,11 @@ TEST_CASE("Convert binary batch table to EXT_feature_metadata") {
std::optional<Schema> schema = metadata->schema;
REQUIRE(schema != std::nullopt);

const std::unordered_map<std::string, Class>& classes = schema->classes;
const phmap::flat_hash_map<std::string, Class>& classes = schema->classes;
REQUIRE(classes.size() == 1);

const Class& defaultClass = classes.at("default");
const std::unordered_map<std::string, ClassProperty>& properties =
const phmap::flat_hash_map<std::string, ClassProperty>& properties =
defaultClass.properties;
REQUIRE(properties.size() == 6);

Expand Down Expand Up @@ -629,11 +629,11 @@ TEST_CASE("Upgrade json nested json metadata to string") {
std::optional<Schema> schema = metadata->schema;
REQUIRE(schema != std::nullopt);

const std::unordered_map<std::string, Class>& classes = schema->classes;
const phmap::flat_hash_map<std::string, Class>& classes = schema->classes;
REQUIRE(classes.size() == 1);

const Class& defaultClass = classes.at("default");
const std::unordered_map<std::string, ClassProperty>& properties =
const phmap::flat_hash_map<std::string, ClassProperty>& properties =
defaultClass.properties;
REQUIRE(properties.size() == 6);

Expand Down Expand Up @@ -719,11 +719,11 @@ TEST_CASE("Upgrade bool json to boolean binary") {
std::optional<Schema> schema = metadata->schema;
REQUIRE(schema != std::nullopt);

const std::unordered_map<std::string, Class>& classes = schema->classes;
const phmap::flat_hash_map<std::string, Class>& classes = schema->classes;
REQUIRE(classes.size() == 1);

const Class& defaultClass = classes.at("default");
const std::unordered_map<std::string, ClassProperty>& properties =
const phmap::flat_hash_map<std::string, ClassProperty>& properties =
defaultClass.properties;
REQUIRE(properties.size() == 1);

Expand Down
1 change: 1 addition & 0 deletions Cesium3DTilesWriter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ target_link_libraries(Cesium3DTilesWriter
Cesium3DTiles
CesiumJsonWriter
GSL
phmap
)

install(TARGETS Cesium3DTilesWriter
Expand Down
2 changes: 1 addition & 1 deletion Cesium3DTilesWriter/generated/src/TilesetJsonWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ template <typename T>

template <typename T>
[[maybe_unused]] void writeJson(
const std::unordered_map<std::string, T>& obj,
const phmap::flat_hash_map<std::string, T>& obj,
CesiumJsonWriter::JsonWriter& jsonWriter,
const CesiumJsonWriter::ExtensionWriterContext& context) {
jsonWriter.StartObject();
Expand Down
20 changes: 15 additions & 5 deletions CesiumAsync/include/CesiumAsync/Impl/RemoveFuture.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,24 @@ namespace CesiumImpl {
// Begin omitting doxgen warnings for Impl namespace
//! @cond Doxygen_Suppress

template <typename T> struct RemoveFuture { typedef T type; };
template <typename T> struct RemoveFuture<Future<T>> { typedef T type; };
template <typename T> struct RemoveFuture<const Future<T>> { typedef T type; };
template <typename T> struct RemoveFuture<SharedFuture<T>> { typedef T type; };
template <typename T> struct RemoveFuture {
typedef T type;
};
template <typename T> struct RemoveFuture<Future<T>> {
typedef T type;
};
template <typename T> struct RemoveFuture<const Future<T>> {
typedef T type;
};
template <typename T> struct RemoveFuture<SharedFuture<T>> {
typedef T type;
};
template <typename T> struct RemoveFuture<const SharedFuture<T>> {
typedef T type;
};
template <typename T> struct RemoveFuture<async::task<T>> { typedef T type; };
template <typename T> struct RemoveFuture<async::task<T>> {
typedef T type;
};
template <typename T> struct RemoveFuture<const async::task<T>> {
typedef T type;
};
Expand Down
1 change: 1 addition & 0 deletions CesiumGltf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ target_link_libraries(CesiumGltf
PUBLIC
CesiumUtility
GSL
phmap
)

install(TARGETS CesiumGltf
Expand Down
Loading