-
Notifications
You must be signed in to change notification settings - Fork 703
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
Fixes #3460. xxxtoxxx
consistency
#3461
Conversation
Hey quick easy optiization: Make them take it as |
That, by the way, is just a good habit to get into when passing structs - especially blittable ones. |
For certain other cases, there's also now |
|
Hm. Why building new points in a lot of those lines rather than just passing the point itself? At the first place in a method that assigns it to something, it'll still get value copied anyway. And with a non-referenceable ephemeral new() in a method call, it will be copied twice, making the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly same minor comments elsewhere, so I won't repeat it all over the place.
Since consistency was the theme for this one anyway, using Offset when offsetting points is probably a good idea, and can also result in less copy activity and more inlining.
The ephemeral constructor stuff, though, is potentially tangible with how hot those code paths are.
Otherwise, YAY!
There's also an Offset overload that takes Point, too, which is better when you already have one. Low-level performance stuff relevant here and other hot pathsIn the case of the Point struct or other blittable structs like it, especially, it's better to pass one of it, whether by value or reference, than to pass components in multiple parameters. It's an 8-byte wide struct, which can fit in one register if sent by itself, whereas 2 ints is two copies in separate registers plus a non-obvious amount of other work at the CIL level and internally in native code. Plus, consistency of the internal layouts of our types also means less of the deconstruction and reconstruction work at boundaries. Man, github, pick a lane: Markdown or HTML. 😆 |
You mean in the tests?
I was focused on getting the API right; perf next. How do you suggest I address this? |
I bit the bullet and changed |
Sounds like it's probably pretty great. I'm only half awake after a wrong number caller woke me up, so I'm useless for review right now but I'll get on that as soon as I'm up and running tomorrow. :) |
Fixes
int
andPoint
#3460MouseEvent
andMouseEventEventArgs
to simplify #3029 (X/Y
->Position
)Proposed Changes/Todos
ScreenToFrame
-> takesPoint
ScreenToViewport
-> takesPoint