mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-19 18:15:50 +00:00
Build the command map at compile time (fixes #3298):
We profiled different algorithms and data structures to understand which strategy is best from a performance standpoint: - Linear search on an array; - Binary search on a sorted array; - Using `std::map`; and - Using `std::unordered_map`. Both linear search and std::unordered_map outperformed the other alternatives so no change to the existing data structure is justified. If more handers are added, this should be revisited. For some additional details and timings, please see: https://github.com/XRPLF/rippled/issues/3298#issuecomment-1185946010
This commit is contained in:
committed by
Nik Bougalis
parent
b88ed5a8ec
commit
9aaa0dff5f
@@ -1227,10 +1227,7 @@ public:
|
||||
int maxParams;
|
||||
};
|
||||
|
||||
// FIXME: replace this with a function-static std::map and the lookup
|
||||
// code with std::map::find when the problem with magic statics on
|
||||
// Visual Studio is fixed.
|
||||
static Command const commands[] = {
|
||||
static constexpr Command commands[] = {
|
||||
// Request-response methods
|
||||
// - Returns an error, or the request.
|
||||
// - To modify the method, provide a new method in the request.
|
||||
|
||||
Reference in New Issue
Block a user