YAML loading optimization (#5997)
* Use rapidyaml library to parse YAML databases instead of yaml-cpp. * Drastically reduces the parse time for yaml databases. * Removes yaml-cpp content from main servers, except for tool emitter. Co-authored-by: Vincent Stumpf <vincents.995@gmail.com> Co-authored-by: Atemo <capucrath@gmail.com> Co-authored-by: Lemongrass3110 <lemongrass@kstp.at> Co-authored-by: Aleos <aleos89@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9bc1c53db4
commit
d1b7061f5a
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
#include "../common/cbasetypes.hpp"
|
||||
#include "../common/db.hpp"
|
||||
@@ -50,7 +49,7 @@ const std::string InstanceDatabase::getDefaultLocation() {
|
||||
* @param node: YAML node containing the entry.
|
||||
* @return count of successfully parsed rows
|
||||
*/
|
||||
uint64 InstanceDatabase::parseBodyNode(const YAML::Node &node) {
|
||||
uint64 InstanceDatabase::parseBodyNode(const ryml::NodeRef node) {
|
||||
int32 instance_id = 0;
|
||||
|
||||
if (!this->asInt32(node, "Id", instance_id))
|
||||
@@ -151,7 +150,7 @@ uint64 InstanceDatabase::parseBodyNode(const YAML::Node &node) {
|
||||
}
|
||||
|
||||
if (this->nodeExists(node, "Enter")) {
|
||||
const YAML::Node &enterNode = node["Enter"];
|
||||
const auto enterNode = node["Enter"];
|
||||
|
||||
if (!this->nodesExist(enterNode, { "Map", "X", "Y" }))
|
||||
return 0;
|
||||
@@ -192,10 +191,12 @@ uint64 InstanceDatabase::parseBodyNode(const YAML::Node &node) {
|
||||
}
|
||||
|
||||
if (this->nodeExists(node, "AdditionalMaps")) {
|
||||
const YAML::Node &mapNode = node["AdditionalMaps"];
|
||||
const auto mapNode = node["AdditionalMaps"];
|
||||
|
||||
for (const auto mapIt : mapNode.children()) {
|
||||
std::string map;
|
||||
c4::from_chars(mapIt.key(), &map);
|
||||
|
||||
for (const auto &mapIt : mapNode) {
|
||||
std::string map = mapIt.first.as<std::string>();
|
||||
int16 m = map_mapname2mapid(map.c_str());
|
||||
|
||||
if (m == instance->enter.map) {
|
||||
|
||||
Reference in New Issue
Block a user