简体   繁体   中英

Xamarin Forms with Prism and DryIoc with a lot of registered page, can reduce performance?

For example, we have a big Xamarin forms project, with 2000 page, and Prism MVVM framework, with DryIoc container, that has registered all 2000 pages.

This a lot of pages, added with DependencyService for example, navigationservice, dialogservice, can reduce navigation's speed and/or performance? It can makes app run slow, for a lot of dependency?

Thanks!!

There isn't a simple answer to this. The general one is - yes. The DryIoc, like any package, is an additional overhead to your project. The IoC container surely adds some time to the overall feeling. Keep in mind that the overhead is minimal - in the matter of some milliseconds. Like it says in the GitHub repo :

Designed for low-ceremony use, performance, and extensibility.

DryIoc is considered to be a relatively fast container. Here is the official IoC Container Benchmark - Performance comparison .

But again, it all depends on how many services you need to instantiate. It doesn't matter if you have 2000 pages. It matters how many dependencies you will have with these pages and how many circular dependencies also.

Also, some of the IoC logic is being done on app start-up and you can also match some of the resolving there.

To sum up - it is better to have IoC container, than to not have one because the flexibility, that you get from it, beats the eventual small overhead of performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM