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

Optimize TileSetAtlasSource::_get_property_list #98317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YYF233333
Copy link

Fixes #98213.

TileSetAtlasSource::_get_property_list used to call vformat a lot with exact same args. Replace pure string formats with string concat and move others to outer loop.

use a slightly modified MRP to make the difference more clear.
testgame.zip

Test Result:
Master:

master.mp4

This PR:

pr.mp4

@YYF233333 YYF233333 requested review from a team as code owners October 18, 2024 20:20
scene/resources/2d/tile_set.cpp Outdated Show resolved Hide resolved
tile_property_list.push_back(alternative_property_info);
}
}

// Add all alternative.
const String property_info_prefix = vformat("%d:%d", E_tile.key.x, E_tile.key.y) + '/';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const String property_info_prefix = vformat("%d:%d", E_tile.key.x, E_tile.key.y) + '/';
const String property_info_prefix = vformat("%d/%d/", E_tile.key.x, E_tile.key.y);
  • Copy-paste error.
  • Plus char is unnecessary since we're already doing vformat().

Copy link
Author

Choose a reason for hiding this comment

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

  • Copy-paste error.

I think it should be %d:%d/%s with the original code, have I missed something with vformat?

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes, I looked at the wrong vformat() call.

Copy link
Member

Choose a reason for hiding this comment

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

I mean, it's not a copy-paste error, using : is correct.

Copy link
Author

@YYF233333 YYF233333 Oct 19, 2024

Choose a reason for hiding this comment

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

I know, just pull to local and squash these commits, will fix it.

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

Successfully merging this pull request may close these issues.

Godot4 editor performance regressions when removing/moving 2D nodes
2 participants