mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
[Strings] Split String Optimizations (#1325)
* Switch the 2 split calls to SplitString * Nuke duplicate split in favor of SplitString #1263 * Add a test for SplitString * Optimize SplitString Benchmarking: -------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------- bench_oldsplit 5201 ns 5201 ns 129500 bench_split 1269 ns 1269 ns 548906 This is splitting a VERY long SpecialAbilities string. This is ~75% speed up.
This commit is contained in:
committed by
GitHub
parent
00fb9bc9f9
commit
dba3010c89
+1
-1
@@ -557,7 +557,7 @@ inline std::string WriteDisplayInfoSection(
|
||||
* "total_to_hit" = "Total To Hit"
|
||||
*/
|
||||
if (attribute_name.find('_') != std::string::npos) {
|
||||
std::vector<std::string> split_string = split(attribute_name, '_');
|
||||
auto split_string = SplitString(attribute_name, '_');
|
||||
std::string new_attribute_name;
|
||||
for (std::string &string_value : split_string) {
|
||||
new_attribute_name += ucfirst(string_value) + " ";
|
||||
|
||||
@@ -93,7 +93,7 @@ void ZoneEventScheduler::Process(Zone *zone, WorldContentService *content_servic
|
||||
}
|
||||
|
||||
if (e.event_type == ServerEvents::EVENT_TYPE_RULE_CHANGE) {
|
||||
auto params = split(e.event_data, '=');
|
||||
auto params = SplitString(e.event_data, '=');
|
||||
auto rule_key = params[0];
|
||||
auto rule_value = params[1];
|
||||
if (!rule_key.empty() && !rule_value.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user