Bug 19669 - CPU hotspot when working with Expression.Lambda and AOT
Summary: CPU hotspot when working with Expression.Lambda and AOT
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: master
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-05-11 00:08 UTC by Frank A. Krueger
Modified: 2017-07-25 00:17 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Image of CPU performance and stacks (1.27 MB, image/png)
2014-05-11 00:08 UTC, Frank A. Krueger

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Frank A. Krueger 2014-05-11 00:08:05 UTC
Created attachment 6777 [details]
Image of CPU performance and stacks

I noticed a hotspot in my CPU performance that revolves around using Linq Expressions and AOT.

Please see the attached image.

The function MocastStorage.AddPodcastEpisodes performs database queries using my sqlite-net library which uses Linq to specify queries.

The AOT calls the method mono_aot_method_hash (aot-compiler.c) which calls mono_type_full_name (debug-helpers.c) which seems to love to play around with copying strings. Is is possible to cache the results of mono_type_full_name or precompile them?
Comment 1 Zoltan Varga 2014-05-11 06:32:20 UTC
That code should only be executed once for each AOT method loaded by the runtime, so it  shouldn't be a hotspot.
Comment 2 Jon Goldberger [MSFT] 2017-07-25 00:17:40 UTC
Thanks so much for taking the time to submit this report! I attempted to reproduce this issue based on the bug description with the latest Xamarin.iOS, and I was unable to. If this issue is still occurring for you, please reopen this report and attach a project that reproduces the issue, ideally starting with a new template project and then adding just the code necessary to demonstrate the issue.