Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] don't probe directories for .config files (mono/mono#18024)
* [android] don't probe directories for .config files In Xamarin.Android, on startup we see logging like this for every .NET assembly: 12-03 14:27:42.104 26842 26842 D Mono : Prepared to set up assembly 'FormsViewGroup' (/storage/emulated/0/Android/data/Xamarin.Forms_Performance_Integration/files/.__override__/FormsViewGroup.dll) 12-03 14:27:42.104 26842 26842 D Mono : Assembly FormsViewGroup[0xebcee9c0] added to domain RootDomain, ref_count=1 12-03 14:27:42.104 26842 26842 D Mono : Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/Xamarin.Forms_Performance_Integration/files/.__override__/FormsViewGroup.dll'. 12-03 14:27:42.104 26842 26842 D Mono : Config attempting to parse: '/storage/emulated/0/Android/data/Xamarin.Forms_Performance_Integration/files/.__override__/FormsViewGroup.dll.config'. 12-03 14:27:42.104 26842 26842 D Mono : Config attempting to parse: '/Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/sdks/out/android-x86-release/etc/mono/assemblies/FormsViewGroup/FormsViewGroup.config'. In most cases, no `.dll.config` file exists and so it probes this macOS-looking path: /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/sdks/out/android-x86-release/etc/mono/assemblies/FormsViewGroup/FormsViewGroup.config It looks like this is happening because nothing in Xamarin.Android calls `mono_set_dirs` or `mono_set_config_dir` and so it falls back to using `MONO_CFG_DIR`. `MONO_CFG_DIR` is set to a path on the build machine. Even if Xamarin.Android *did* call `mono_set_config_dir`, the code appends `mono/assemblies`: cfg = g_build_filename (cfg_dir, "mono", "assemblies", aname, cfg_name, (const char*)NULL); So it doesn't seem useful to use this fallback at all, there would never be a file found. I wrapped the appropriate code in `#ifndef TARGET_ANDROID` blocks. I was able to see a minor *maybe* ~20ms performance improvement on startup: Before: 12-03 14:27:48.494 26903 26903 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:601::443900 12-03 14:27:54.356 26963 26963 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:587::495400 12-03 14:28:00.263 27021 27021 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:586::147100 12-03 14:28:06.135 27074 27074 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:593::639100 12-03 14:28:11.988 27129 27129 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:571::194900 After: 12-03 14:46:50.590 27737 27737 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:503::918700 12-03 14:46:56.517 27794 27794 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:570::533600 12-03 14:47:02.368 27850 27850 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:537::435000 12-03 14:47:08.289 27904 27904 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:587::830900 12-03 14:47:14.130 27965 27965 I monodroid-timing: Runtime.init: end, total time; elapsed: 0s:555::593400 This was the Xamarin.Forms integration project in xamarin-android. Running a `Debug` build on a HAXM x86 emulator on Windows. https://github.com/xamarin/xamarin-android/tree/master/tests/Xamarin.Forms-Performance-Integration * Add --enable-minimal=cfgdir_config * This also defines `DISABLE_CFGDIR_CONFIG` * Used this setting for android Commit migrated from mono/mono@b816189
- Loading branch information