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

Use the new string_name_new_with_latin1_chars function to improve StringName construction performance #1263

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Oct 12, 2023

Integrates the changes from PR godotengine/godot#78580

@dsnopek dsnopek added the enhancement This is an enhancement on the current functionality label Oct 12, 2023
@dsnopek dsnopek added this to the 4.x milestone Oct 12, 2023
@dsnopek dsnopek requested a review from a team as a code owner October 12, 2023 02:39
@dsnopek dsnopek added the topic:gdextension This relates to the new Godot 4 extension implementation label Oct 12, 2023
@@ -458,8 +458,9 @@ String operator+(char32_t p_char, const String &p_str) {
return String::chr(p_char) + p_str;
}

StringName::StringName(const char *from) :
StringName(String(from)) {}
StringName::StringName(const char *from, bool p_static) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question, but why do String and StringName definitions live in a char_string.cpp file instead of string.cpp and/or string_name.cpp? Sounds like it was created for CharString (which is an implementation detail of String).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably mild laziness :-)

Most of String and StringName are automatically generated code, they just have a couple of handwritten methods, whereas as all of CharString is handwritten. So, I'm guessing someone just thought, "ah, it's string-related, I'll just throw these in char_string.cpp" rather than making new handwritten string.cpp and string_name.cpp files.

@akien-mga akien-mga requested a review from bruvzg October 12, 2023 07:18
@akien-mga akien-mga merged commit 4f0eb2f into godotengine:master Oct 12, 2023
12 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga modified the milestones: 4.x, 4.2 Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an enhancement on the current functionality topic:gdextension This relates to the new Godot 4 extension implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants