测量不同设备中几个Android依赖注入框架的性能

网友投稿 585 2022-11-02

测量不同设备中几个Android依赖注入框架的性能

测量不同设备中几个Android依赖注入框架的性能

Android Injection Performance

This project aims to measure the performance of several Dependency Injection frameworks (or Service Locators) in different devices.

Libraries tested

Koin - 1.0.1Kodein - 5.3.0Dagger 2 - 2.16

The test

The test data are classes with dependencies in a structure similar to Fibonacci sequence, to simulate multiple levels of transitive dependencies. For each library there is a test with Kotlin classes and one with Java classes, because some libraries seem to be affected by this.

Each test injects one of this dependencies 100 times and prints the maximum time, the minimum and the average.

The project contains an Android application that run the tests on its onCreate and prints the result to the Logcat.

The actual test is implemented in the class InjectionTest.kt

Results

Results can be quite different between different devices, so here are some results in different devices with different Android versions. More results are welcomed.

Samsung Galaxy J5Huawei P8 LiteOnePlus OneOnePlus 5Nexus 6

Samsung Galaxy J5

=========|=====================Device: | samsung j5nlte v6.0.1---------|--------------------Test: | Koin + KotlinMin-Max: | 47,41-74,25 msAverage: | 60,16 ms---------|--------------------Test: | Koin + JavaMin-Max: | 189,77-205,96 msAverage: | 194,09 ms---------|--------------------Test: | Kodein + KotlinMin-Max: | 0,76-3,38 msAverage: | 0,83 ms---------|--------------------Test: | Kodein + JavaMin-Max: | 0,82-4,67 msAverage: | 0,93 ms---------|--------------------Test: | Dagger2 + KotlinMin-Max: | 0,03-9,48 msAverage: | 0,12 ms---------|--------------------Test: | Dagger2 + JavaMin-Max: | 0,02-2,03 msAverage: | 0,05 ms=========|=====================

Huawei P8 Lite

=========|=====================Device: | Huawei hwALE-H v6.0---------|--------------------Test: | Koin + KotlinMin-Max: | 245,43-273,91 msAverage: | 253,30 ms---------|--------------------Test: | Koin + JavaMin-Max: | 373,67-399,93 msAverage: | 377,57 ms---------|--------------------Test: | Kodein + KotlinMin-Max: | 7,49-15,63 msAverage: | 7,63 ms---------|--------------------Test: | Kodein + JavaMin-Max: | 7,94-10,78 msAverage: | 8,08 ms---------|--------------------Test: | Dagger2 + KotlinMin-Max: | 0,22-5,60 msAverage: | 0,28 ms---------|--------------------Test: | Dagger2 + JavaMin-Max: | 0,20-5,04 msAverage: | 0,25 ms=========|=====================

OnePlus One

=========|=====================Device: | oneplus A0001 v5.0.2---------|--------------------Test: | Koin + KotlinMin-Max: | 26,78-73,14 msAverage: | 34,38 ms---------|--------------------Test: | Koin + JavaMin-Max: | 105,04-201,14 msAverage: | 128,99 ms---------|--------------------Test: | Kodein + KotlinMin-Max: | 1,11-3,34 msAverage: | 1,34 ms---------|--------------------Test: | Kodein + JavaMin-Max: | 1,27-3,06 msAverage: | 1,40 ms---------|--------------------Test: | Dagger2 + KotlinMin-Max: | 0,02-2,81 msAverage: | 0,07 ms---------|--------------------Test: | Dagger2 + JavaMin-Max: | 0,02-1,84 msAverage: | 0,05 ms=========|=====================

OnePlus 5

=========|=====================Device: | OnePlus OnePlus5 v8.1.0---------|--------------------Test: | Koin + KotlinMin-Max: | 4,08-23,18 msAverage: | 5,04 ms---------|--------------------Test: | Koin + JavaMin-Max: | 4,61-11,47 msAverage: | 5,16 ms---------|--------------------Test: | Kodein + KotlinMin-Max: | 0,09-3,51 msAverage: | 0,27 ms---------|--------------------Test: | Kodein + JavaMin-Max: | 0,09-1,03 msAverage: | 0,16 ms---------|--------------------Test: | Dagger2 + KotlinMin-Max: | 0,01-0,42 msAverage: | 0,04 ms---------|--------------------Test: | Dagger2 + JavaMin-Max: | 0,01-0,32 msAverage: | 0,03 ms=========|=====================

Nexus 6

=========|=====================Device: | google shamu v7.1.1---------|--------------------Test: | Koin + KotlinMin-Max: | 12,47-52,59 msAverage: | 15,56 ms---------|--------------------Test: | Koin + JavaMin-Max: | 15,30-26,37 msAverage: | 17,14 ms---------|--------------------Test: | Kodein + KotlinMin-Max: | 0,50-13,12 msAverage: | 1,50 ms---------|--------------------Test: | Kodein + JavaMin-Max: | 0,52-5,87 msAverage: | 0,98 ms---------|--------------------Test: | Dagger2 + KotlinMin-Max: | 0,13-1,46 msAverage: | 0,32 ms---------|--------------------Test: | Dagger2 + JavaMin-Max: | 0,10-1,15 msAverage: | 0,30 ms=========|=====================

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:基于2017-05阿里云更新的短信接口,适应Laravel框架
下一篇:Flask框架远程命令执行-学习笔记
相关文章

 发表评论

暂时没有评论,来抢沙发吧~