-
Notifications
You must be signed in to change notification settings - Fork 4
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
Raycast performance #70
Open
andrewdolce
wants to merge
22
commits into
develop
Choose a base branch
from
raycast-performance
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allocations are replaced with get and del functions to recycle objects from memory pools. In some cases, "set" functions were added to a few object types so that they can be easily reinitialized without causing unwanted allocation.
Transform inverseTimes() was being called without a destination.
Removed allocations in closestPtPointTetrahedron and pointOutsideOfPlane. Also removed a pointless conditional from closestPtPointTetrahedron.
Recycle Vector3 and array objects. The `stack` array is handled as a special case with its own memory pool. This is because the stack array needs to be resized and could end up being large. By recycling it and only resizing when we need the length to increase, we can make it so that the resize only happens a finite number of times, until there exist arrays of sufficient length for all future ray tests.
add LocalAddrInfo2.set to set values of objects acquired from mempool.
add delArray to Dbvt.rayCast remove tmpV4 and tmpV5. Bounds isn't edited in RayAabb2 so we don't need them.
Change object to be of the form { "value": 0 } instead of { "tmin": 0 } to be consistent with other uses of scalar references in the port.
List of allocations removed: - array in rayTestInternal - scalar reference in rayTestInternal - scalar reference in rayTest - scalar reference in maxdepth
The `signs` property was incorrectly initialized as a Vector3, but is now correctly initialized as an Array. Also removed unnecessary array-like access to Vector3 variables.
The `set` function is used in place of `clone` when re-initializing a recycled SphereShape. It is similar to `init` but unrolls all the calls to _super into a single function and removes any unnecessary or redundant statements. Currently used in `CollisionWorld.rayTestSingle`.
The unit test had not been updated to reflect the newly corrected type for the `signs` property.
Made separate ray-performance test, and restored performance.js to match with the general performance test from the develop branch. Changed the ray-performance `stats.begin()` and `stats.end()` calls to match with the updated ones from develop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
General optimization of raycast-related code.
Adds a ray-performance.js test based on performance.js, which adds 4 raycasts for each rigidbody
and also steps the simulation 10 times per frame.
Removes allocations from: