Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
In bug #18068, a new flag has been added to Mono runtime to support locals init=false.
This result in various speedup in JIT (it avoids double clearing/setting of memory in many cases, especially combined with "out" memory). This is very useful in game programming, especially for mathematics code and some very tight loop that we have to put in separate functions due to "ref" array accesses.
However, the platform that needs this the most (Android) doesn't have a way (that I know of) to pass flags to the runtime. On Windows it would be "mono -O=unsafe app.exe" but on Android there is no way to add "-O=unsafe" somewhere.
Would it be possible to add this flag somewhere in Xamarin.Android?
Note: this speedup apply also when stack is reused differently during branching (if/else).
On Windows, we measured performance increase around 10+%, so we hope it could be even better on Android.
BTW, the previous 10+% I mentionned was overall, but on the actual specific code, it could sometime takes up to 80% of the function time (i.e. a function with lot of branching => few instructions, and lot of potentially unused stack).
You should be able to ass these flags using the `debug.mono.runtimeargs` property: