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:
Jittapan Pluemsumran
2022-03-31 03:38:52 +07:00
committed by GitHub
parent 9bc1c53db4
commit d1b7061f5a
303 changed files with 60500 additions and 916 deletions

View File

@@ -4,7 +4,6 @@
#include "guild.hpp"
#include <stdlib.h>
#include <yaml-cpp/yaml.h>
#include "../common/cbasetypes.hpp"
#include "../common/database.hpp"
@@ -74,14 +73,14 @@ public:
}
const std::string getDefaultLocation() override;
uint64 parseBodyNode( const YAML::Node& node ) override;
uint64 parseBodyNode( const ryml::NodeRef node ) override;
};
const std::string GuildSkillTreeDatabase::getDefaultLocation(){
return std::string(db_path) + "/guild_skill_tree.yml";
}
uint64 GuildSkillTreeDatabase::parseBodyNode( const YAML::Node &node ){
uint64 GuildSkillTreeDatabase::parseBodyNode( const ryml::NodeRef node ){
std::string name;
if( !this->asString( node, "Id", name ) ){
@@ -129,7 +128,8 @@ uint64 GuildSkillTreeDatabase::parseBodyNode( const YAML::Node &node ){
}
if( this->nodeExists( node, "Required" ) ){
for( const YAML::Node& requiredNode : node["Required"] ){
const auto reqNode = node["Required"];
for( const auto requiredNode : reqNode.children() ){
std::string requiredName;
if( !this->asString( requiredNode, "Id", requiredName ) ){
@@ -274,7 +274,7 @@ const std::string CastleDatabase::getDefaultLocation() {
return std::string(db_path) + "/castle_db.yml";
}
uint64 CastleDatabase::parseBodyNode(const YAML::Node &node) {
uint64 CastleDatabase::parseBodyNode(const ryml::NodeRef node) {
int32 castle_id;
if (!this->asInt32(node, "Id", castle_id))