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

Optimization of the render pipeline cache access on WebGPU #5490

Merged
merged 3 commits into from
Jul 20, 2023

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Jul 19, 2023

The initial render pipeline cache was a string concatenation based and its performance was not ideal due to longer strings getting constructed / compared for each draw call.

This PR switches the unique ID from string to an array of numbers, which gets hashed to a single number for the cache lookup. To handle the hash collisions (which are pretty much non existing when testing with less than 100k unique arrays), the array compare is used as well.

Performance improvement in Hierarchy engine examples with over 5k draw calls:

tweet

@mvaligursky mvaligursky self-assigned this Jul 19, 2023
@mvaligursky mvaligursky added performance Relating to load times or frame rate area: graphics Graphics related issue labels Jul 19, 2023
@mvaligursky mvaligursky mentioned this pull request Jul 19, 2023
src/core/hash.js Outdated Show resolved Hide resolved
@willeastcott
Copy link
Contributor

This is the kind of performance boost I love. ❤️

Co-authored-by: Will Eastcott <will@playcanvas.com>
@mvaligursky mvaligursky merged commit 90f4533 into main Jul 20, 2023
@mvaligursky mvaligursky deleted the mv-opmimize-pipeline-cache branch July 20, 2023 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue performance Relating to load times or frame rate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants