dotlottie-web icon indicating copy to clipboard operation
dotlottie-web copied to clipboard

DotLottie worker

Open theashraf opened this issue 1 year ago • 1 comments

Overview

Some Lottie animations might be resource-intensive to render based on the Lottie features utilized and the size. While this is generally acceptable, performance can become an issue when there are multiple animations running simultaneously. Offloading the rendering to a worker thread can help improve performance

This enhancement involves developing a DotLottieWorker class, which will utilize the core dotlottie-rs WebAssembly (WASM) bindings within a Worker thread. This feature should not introduce any breaking changes to the current DotLottie setup and usage, and it will be an opt-in feature

Motivation

What inspired this enhancement? What makes you think this should be included?

The main motivation for this enhancement is to improve the performance of the DotLottie web library when handling multiple animations. By offloading rendering tasks to individual worker threads, we can ensure smoother animations and better overall performance, especially in scenarios where multiple animations are present

Labels

  • [x] Add the Type: Enhancement label to this issue.

theashraf avatar May 21 '24 07:05 theashraf

@theashraf jyfi, thorvg nested threads will improve the performance as well. probably dotlottie could consider applying either one which is better for perf & size.

hermet avatar May 21 '24 07:05 hermet

Hi @theashraf - I'm very interested in this enhancement! is there an ETA for targeted release (weeks/months)?

danrydholm avatar May 28 '24 17:05 danrydholm

Hi @danrydholm,Thank you for your interest. we expect to support this by next month. In the meantime, if you would like to offload DotLottie to a worker, there is a CodePen example demonstrating how this can be done: CodePen example

theashraf avatar May 28 '24 17:05 theashraf

Added in @lottiefiles/[email protected] release

theashraf avatar Jul 04 '24 13:07 theashraf

Now that this feature is completed, is there any reason not to always use it with web worker? What should be the default?

tamirzas avatar Feb 25 '25 13:02 tamirzas