I'm building a mobile app that have many panels and I was wondering if it's a good idea (in regards of performance, memory use, code size and ease of maintainability) to have one Ractive instance by panel or if it's preferable to have only one Ractive instance for the whole application? I'm leaning towards many instances for ease of maintainability but I really don't know how it will affect performance and memory use.

有帮助吗?

解决方案

The overhead for creating additional instances is very small - it's only really if you're creating hundreds or thousands of instances (whether directly, or as inline components) that you might find you need to optimise things.

So in general I'd advise writing the application in the way that's most maintainable. If you did find that performance was a problem, then depending on the nature of your app you might find a happy medium between having a single instance for the entire thing, and dividing it too finely.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top