Legion runs ~23 times slower on iOS than desktop for WASM
- Ngôn ngữ chính
- Rust
- Star
- 1.7k
- Fork
- 140
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Hello, I've noticed a large discrepancy in the time it takes to use Legion with WASM between my MacBook Pro and my iPad Pro. I have created a benchmark project with more explanation [here](https://github.com/tuzz/legion-ecs-wasm-benchmark). You can run the benchmark for yourself [here](https://tuzz.github.io/legion-ecs-wasm-benchmark/).
In short, my iPad Pro, which is supposedly faster at WASM based on other benchmarks, is running about 23x slower for an entity creation/update test and I don't understand why. Is this something other people have noticed on mobile devices? Does anyone have any idea why this is happening?
I'd be happy to investigate further once I have a thread to pull on.
Thanks
---
MacBook Pro results
```
Benchmarking Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
-----------------------------------------------------
Number of entities: 65536
Creating entities took 7.504999986849725 ms
Adding components took 1.2949999945703894 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 8.734999981243163 ms
Adding components took 2.785000018775463 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 11.304999992717057 ms
Adding components took 3.995000006398186 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 31.430000002728775 ms
Adding components took 7.805000001098961 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 46.000000002095476 ms
Adding components took 14.005000004544854 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 97.06000000005588 ms
Adding components took 36.89499999745749 ms
-----------------------------------------------------
```
iPad Pro results
```
Benchmarking Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15
-----------------------------------------------------
Number of entities: 65536
Creating entities took 22 ms
Adding components took 4 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 21.000000000000114 ms
Adding components took 6.999999999999886 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 64 ms
Adding components took 13 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 191 ms
Adding components took 27 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 674 ms
Adding components took 60 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 2533 ms
Adding components took 143 ms
-----------------------------------------------------
```
(The following are results I've received from other people)
iPhone 11 results
```
Benchmarking Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1
-----------------------------------------------------
Number of entities: 65536
Creating entities took 26 ms
Adding components took 4 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 24 ms
Adding components took 9 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 76 ms
Adding components took 16 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 231.9999999999999 ms
Adding components took 33 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 805.0000000000002 ms
Adding components took 73.99999999999977 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 3178 ms
Adding components took 193 ms
-----------------------------------------------------
```
Another iPhone 11, I think
```
Benchmarking Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/83.0.4103.88 Mobile/15E148 Safari/604.1
-----------------------------------------------------
Number of entities: 65536
Creating entities took 36 ms
Adding components took 4 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 28 ms
Adding components took 11 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 98 ms
Adding components took 20 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 294.0000000000001 ms
Adding components took 41.999999999999886 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 1027.0000000000002 ms
Adding components took 86.99999999999977 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 4119 ms
Adding components took 244.0000000000009 ms
-----------------------------------------------------
```
Google Pixel 2
```
Benchmarking Mozilla/5.0 (Linux; Android 10; Pixel 2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36
-----------------------------------------------------
Number of entities: 65536
Creating entities took 95.00000000116415 ms
Adding components took 21.099999983562157 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 141.00000000325963 ms
Adding components took 49.80000000796281 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 396.50000000256114 ms
Adding components took 86.29999999538995 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 1333.8000000221655 ms
Adding components took 192.79999998980202 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 4753.399999986868 ms
Adding components took 413.8000000093598 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 17166.800000006333 ms
Adding components took 969.0000000118744 ms
-----------------------------------------------------
```
Another MacBook Pro
```
Benchmarking Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:77.0) Gecko/20100101 Firefox/77.0
-----------------------------------------------------
Number of entities: 65536
Creating entities took 8 ms
Adding components took 4 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 11 ms
Adding components took 6 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 13 ms
Adding components took 5 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 26 ms
Adding components took 10 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 51 ms
Adding components took 23 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 117 ms
Adding components took 47 ms
-----------------------------------------------------
```
An Ubuntu machine
```
Benchmarking Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0
-----------------------------------------------------
Number of entities: 65536
Creating entities took 13 ms
Adding components took 5 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 10 ms
Adding components took 3 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 16 ms
Adding components took 5 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 35 ms
Adding components took 9 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 65 ms
Adding components took 18 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 142 ms
Adding components took 135 ms
-----------------------------------------------------
```
Another Mac
```
Benchmarking Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:77.0) Gecko/20100101 Firefox/77.0
-----------------------------------------------------
Number of entities: 65536
Creating entities took 8 ms
Adding components took 2 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 7 ms
Adding components took 3 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 12 ms
Adding components took 6 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 26 ms
Adding components took 11 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 53 ms
Adding components took 20 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 108 ms
Adding components took 40 ms
-----------------------------------------------------
```
Google Pixel 3a
```
Benchmarking Mozilla/5.0 (Android 10; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0
-----------------------------------------------------
Number of entities: 65536
Creating entities took 17 ms
Adding components took 5 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 30 ms
Adding components took 11 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 59 ms
Adding components took 23 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 121 ms
Adding components took 43 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 245 ms
Adding components took 89 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 516 ms
Adding components took 175 ms
-----------------------------------------------------
```
A linux machine
```
Benchmarking Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
-----------------------------------------------------
Number of entities: 65536
Creating entities took 29.699999999138527 ms
Adding components took 8.430000001681037 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 14.914999999746215 ms
Adding components took 4.694999995990656 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 30.610000001615845 ms
Adding components took 7.729999997536652 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 64.49499999871477 ms
Adding components took 13.354999995499384 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 141.2899999995716 ms
Adding components took 26.005000006989576 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 288.074999996752 ms
Adding components took 46.93499999848427 ms
-----------------------------------------------------
```
11" iPad Pro (desktop browsing mode)
```
Benchmarking Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15
-----------------------------------------------------
Number of entities: 65536
Creating entities took 22 ms
Adding components took 4 ms
-----------------------------------------------------
Number of entities: 131072
Creating entities took 21 ms
Adding components took 7 ms
-----------------------------------------------------
Number of entities: 262144
Creating entities took 68 ms
Adding components took 15 ms
-----------------------------------------------------
Number of entities: 524288
Creating entities took 232 ms
Adding components took 38 ms
-----------------------------------------------------
Number of entities: 1048576
Creating entities took 912 ms
Adding components took 75 ms
-----------------------------------------------------
Number of entities: 2097152
Creating entities took 3839 ms
Adding components took 185 ms
-----------------------------------------------------
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.