Skip to content

Conversation

tguerin
Copy link
Contributor

@tguerin tguerin commented Nov 20, 2024

When using AssetLoader for runtime asset swapping, there is no straightforward way to reuse a RiveFile. Each time it's needed, it must be re-imported. While debugging performance, I noticed a significant amount of time was spent in the _readRuntimeObject method, leading to inefficiencies.

To address this, I implemented a caching mechanism to store RiveFile objects and enable cloning them directly in memory. This eliminates the need for repetitive re-imports and significantly reduces loading overhead.

This change resulted in a substantial improvement in loading times, with a performance boost of 4x to 10x depending on the use case.

What do you think about this approach? Are there any additional considerations or potential pitfalls I should address?

@HayesGordon
Copy link
Contributor

This is great, @tguerin; we'll get this reviewed as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants