ractivejs / ractive

Next-generation DOM manipulation
http://ractive.js.org
MIT License
5.94k stars 396 forks source link

I applied it in an embedded device, but the speed of rendering multiple templates at the same time is too slow. Is there a way to render asynchronously? #3390

Closed yangzheng006 closed 3 years ago

yangzheng006 commented 3 years ago

Description:

I applied it in an embedded device, but the speed of rendering multiple templates at the same time is too slow. Is there a way to render asynchronously?

Versions affected:

Platforms affected:

Reproduction:

evs-chris commented 3 years ago

Are you rendering to DOM or to strings?

Ractive was very much designed to be a synchronous library, so there's really not much to be done for asynchronous rendering in-browser. If you're rendering your templates to string, there's probably a much faster library to do so, as it doesn't require ractive's main feature - reactivity. If you're rendering to DOM, the best way to reduce render speed is to render fewer things simultaneously, which is unfortunately not a very helpful answer and depends on what you're trying to accomplish. For instance, very long lists that scroll can be rendered virtually - where only a few items in the visible viewport are actually rendered and the scrollbars are made accurate with padding offsets before and after the rendered chunk. For something like tabs, you can make sure that non-visible content is not rendered by keeping it in an if block, which unrenders when its condition is falsey.

yangzheng006 commented 3 years ago

rendering to DOM