Made many Rect/FRect
methods fastcall
#2043
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I created a new function that converts fastcall arguments in a rect to avoid repetition. I also made a bunch of easily modifiable
Rect
methods that take rects as argumentsMETH_FASTCALL
. This should generally make them faster. I cleaned up the internalRect
init` function as well. This PR, along with #2041, should make non-rect conversions substantially faster.Here are the changes I made:
RectExport_RectFromFastcallArgs
internal functioncolliderect
to use the newRectExport_RectFromFastcallArgs
functionRect
init method a bit.clip
to useFASTCALL
clamp/clamp_ip
to useFASTCALL
fit
to useFASTCALL
update
to useFASTCALL
union/union_ip
to useFASTCALL
Results:
TLDR:
Rect
/FRect
or 4 args are passed, the new implementation is 2X faster on my PC.Note:
Rect
constructors/colliderect
might appear slightly slower, but they are results that are in the noise and are not significant. In fact,colliderect
has the same functionality as before and it just uses the new function. The constructor was just tidied up a bit."OLD RECT
NEW RECT
OLD FRECT
NEW FRECT
Code