Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POC for faster instantiation of NSObject subclasses by using factory …
…classes instead of reflection. Idea: create an instance of a factory class that is able to create an instance of the desired type without using reflection. This POC is hardcoded to only implement support for UIView (since that's what the test case is creating). If productized, the factory class would have to be created by the generator. Numbers are impressive: ~40% faster. Downsides: a lot of extra generated code (bloat) - i.e. bigger apps. Numbers ======= Test case: rolfbjarne/TestApp@004283d Fix 1 refers to PR xamarin#5009. Fix 2 refers to PR xamarin#5013. Fix 3 refers to PR xamarin#5016. Fix 4 refers to PR xamarin#5017. Fix 5 is this fix. iPad Air 2 ---------- | Configuration | Before | After fix 1 | After fix 2 | After fix 3 | After fix 4 | After fix 5 | Improvement from fix 4 to fix 5 | Cumulative improvement | | ------------------- | ------ | ----------: | -----------: | -----------: | -----------: | -----------: | ------------------------------: | ---------------------: | | Release (link all) | 477 ms | 481 ms | 224 ms | 172 ms | 148 ms | 86 ms | 62 ms (42%) | 391 ms (82%) | | Release (dont link) | 738 ms | 656 ms | 377 ms | 201 ms | 146 ms | 88 ms | 58 ms (40%) | 650 ms (88%) | iPhone X -------- | Configuration | Before | After fix 1 | After fix 2 | After fix 3 | After fix 4 | After fix 5 | Improvement from fix 4 to fix 5 | Cumulative improvement | | ------------------- | ------ | ----------: | -----------: | -----------: | -----------: | -----------: | ------------------------------: | ---------------------: | | Release (link all) | 98 ms | 99 ms | 42 ms | 31 ms | 29 ms | 18 ms | 11 ms (38%) | 80 ms (82%) | | Release (dont link) | 197 ms | 153 ms | 91 ms | 43 ms | 28 ms | 17 ms | 11 ms (39%) | 180 ms (91%) | When linking all assemblies, the type map has 24 entries, and when not linking at all it has 2993 entries.
- Loading branch information