optimize render sorting performance#117
optimize render sorting performance#117fereidani wants to merge 1 commit intoAryanpurTech:masterfrom
Conversation
|
regarding the PR itself, there are some issues:
Alternatively, a better optimization in my opinion would be caching the sort result and checking if any change have been made. This can be done as easily as a separate field with a boolean, which again is unnecessary for its scale. Another one that can help the engine in general would be swapping the hashing function of the HashMap that objects are stored in with a faster and cryptographically unsafe hashing algorithm. All in all, it is an amazing PR, just perhaps the issues it can bring would be larger than the benefits in majority of our userbase's usecases The Kabuli Palu is earned regardless of merge XD |
|
Hey Elham, About the caching, you can add add a generation token, update that generation token whenever a object is removed or added to the ObjectStorage. Best way to implement it is to move sorting logic to ObjectStorage implementation. Apart these: |
|
This is really interesting, I'll do a stress test this coming weekend, will report here once done. |
Hey Elham, Cool project!
This optimizes your render sorting by reducing sorting size(code isn't using &Arc reference and it only increase memory swap time while sorting(2x copy time)) and also pre-allocated the buffer so it doesn't heap allocate in the program render loop.
You can remove the unsafe part yourself later by adding lifetimes.
Important Note: If you merge this, you owe me a Kabuli Pulu!