Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Profanity and Reserved names functionality #18556

Closed
walkline opened this issue Mar 15, 2024 · 4 comments · Fixed by #19259
Closed

Refactor Profanity and Reserved names functionality #18556

walkline opened this issue Mar 15, 2024 · 4 comments · Fixed by #19259

Comments

@walkline
Copy link
Contributor

walkline commented Mar 15, 2024

Describe your feature request or suggestion in detail

At the moment these two functions are heavily unoptimized:

bool ReservedNames(std::wstring& name)

bool ProfanityNames(std::wstring& name)

The thing is that we iterating over 25 000 strings, then we are making some replacements in every of them and finally we are making comparison.
We are calling it on every login and character creation, which can be resulted in diff spikes.

During my load testing with 1 000 characters login the diff spike was 22k ms (22 seconds).
Screenshot 2024-03-15 at 13 27 59

When I disabled StrictNames.Reserved & StrictNames.Profanity, the same test - the spike is 2k ms (2 seconds).
Screenshot 2024-03-15 at 13 32 35

Describe a possible solution to your feature or suggestion in detail

We should move this logic to the server loading stage. At this stage, we would build a search tree (e.g., std::set) from normalized strings. During "runtime", we can simply search for the word in this tree (which would take O(log n) time instead O(n)+string normalization on every iteration).

Additional context

No response

@Elmsroth
Copy link
Contributor

Agree 100%

@PkllonG
Copy link
Contributor

PkllonG commented Mar 16, 2024

I DON'T KNOW WHY, SUNWELLCORE IS BETTER THAN THE CURRENT CORE PERFORMANCE

@Nyeriah
Copy link
Member

Nyeriah commented Mar 16, 2024

Because it was a little more than a collection of hacks with barely anything working as it should?

@Kitzunu
Copy link
Member

Kitzunu commented Jul 2, 2024

#19259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants