This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Fix excessive onSpriteLoaded() notifications
What happened: The excessive `onSpriteLoaded()` notifications were caused by the trick inside `OnlineFileRequest::completed()` implemenation, which causes receving of two file source updates pointing to the *same* data in case the network response is `notModified` and the local storage has the sprite sheet already stored inside. In the SpriteLoader` implementation, it resulted in 2 extra `parseSprite()` calls and 2 extra `onSpriteLoaded()` notifications. Then, the excessive `onSpriteLoaded()` notifications affected style images and all the unnecessarily added image dupes (btw, the amount of these dupes `= 2 * number of style images`) were treated by the `RenderOrchestrator` as *updated* images. Further, `RenderOrchestrator` called `ImageManager::updateImage()` for the updated images and the `ImageManager` populated the `updatedImageVersions` map. Finally, at every frame all the geometry tiles iterated through the `updatedImageVersions` to check whether their uploaded textures needed patching. All the mentioned above had a negative performance impact. The fix: Now, `SpriteLoader` sends `onSpriteLoaded()` notifications only if the data in the file source response is different comparing to the existing one.
- Loading branch information