Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sprite scale: Preserve performance#2389

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DragonMoffon merged 12 commits intodevelopmentfromscale-tweaks
Oct 14, 2024
Merged

Conversation

einarf
Copy link
Member

TheSprite.scale changes made the property 4-5 times slower. Instead we introduce methods to handle uniform scaling.

@DragonMoffon
Copy link
Collaborator

Id like to try one last thing before we go ahead. Since the biggest cost with the Vec2 is around creation and GC I wonder if making a slotted murable Vec-like with support for piecewise operations would be performant enough. Like working with lists it may have a few hickups, but Ill implement__copy__

@DigiDuncan
Copy link
Collaborator

Id like to try one last thing before we go ahead. [...]

I'm curious to see this before we push this one through -- the DX is a tad clunky and it won't be forward-compatible with 3.1. I'm fine with it if Dragon's proposal doesn't get done/isn't up to snuff, though, I agree it's a better option then lying to the user as to what the underlying scale is.

@einarf
Copy link
MemberAuthor

einarf commentedOct 8, 2024
edited
Loading

The amount of things that broke due to this change was minuscule so I'm not too worried. The new methods are also a lot faster than the scale property can be. Especially when adding and multiplying scale simply because it's one callable less compared to+= and*=.

This also needs to be checked before merge. Ensure all subclasses ofBasicSprite is typed to allow a tuple as well.
#2399

The names we had for the scale methods didn't feel right for arcade/python so they have been changed to be more readable.While the concern about confusing the user is valid I think the change is worth it. During the interim before we do a larger re-write this is a nicer developer experience than using a method. Most developers set the sprite scale once, and then don't change it in the future.the `isinstance` check for `AsFloat` is no-where near the cost of creating a vector.In my ideal world sprite would not have a scale property at all, and instead scale is a method that changes the size of the sprite.
@DigiDuncanDigiDuncan marked this pull request as ready for reviewOctober 11, 2024 10:36
Copy link
Collaborator

@DigiDuncanDigiDuncan left a comment

Choose a reason for hiding this comment

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

As much as the functions feel a tad clunky still, the speed can't be denied, and I'm more concerned about the return ofscale = float for DX reasons. Seems good to me until 3.1+.

@DragonMoffonDragonMoffon merged commit0444db5 intodevelopmentOct 14, 2024
9 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@DigiDuncanDigiDuncanDigiDuncan approved these changes

@DragonMoffonDragonMoffonDragonMoffon approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Allow tuple scale in arcade.Sprite init, same as the setter Review performance impact ofSprite.scale changes
3 participants
@einarf@DragonMoffon@DigiDuncan

[8]ページ先頭

©2009-2025 Movatter.jp