xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.42k stars 507 forks source link

XmlReader performance #20674

Closed PureWeen closed 4 weeks ago

PureWeen commented 1 month ago

Issue moved from dotnet/maui#10103


From @jared-morley on Tuesday, September 13, 2022 11:00:05 PM

Description

We are seeing significant performance issues attempting to read an xml document using xmlreader on iOS. Attempting to read the same file in Maui is approx 10x slower then it was previously using Xamarin Forms.

Steps to Reproduce

  1. Open the maui project
  2. Press the "Test" button to read it using XmlReader
  3. Observe the time taken
  4. Open the xf project
  5. Press the "Test" button to read it using XmlReader
  6. Observe the time taken

Link to public reproduction project repository

https://github.com/jared-morley/XmlReaderPerformance

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15

Did you find any workaround?

No response

Relevant log output

No response

PureWeen commented 1 month ago

Issue moved from dotnet/maui#10103


From @drasticactions on Wednesday, September 14, 2022 4:48:00 AM

Did you try running the same benchmark in a .NET 6 iOS (dotnet new ios) application that doesn't use MAUI (The UI Framework?)

CC @dalexsoto

PureWeen commented 1 month ago

Issue moved from dotnet/maui#10103


From @ghost on Wednesday, September 14, 2022 4:48:15 AM

Hi @jared-morley. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

PureWeen commented 1 month ago

Issue moved from dotnet/maui#10103


From @jared-morley on Friday, September 16, 2022 5:03:14 AM

We have updated the repo to include a .net 6 iOS application. A sample of the results we are seeing are as follows:

PureWeen commented 1 month ago

Issue moved from dotnet/maui#10103


From @ghost on Friday, September 16, 2022 2:22:29 PM

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

PureWeen commented 1 month ago

Issue moved from dotnet/maui#10103


From @jared-morley on Sunday, September 18, 2022 10:53:52 PM

Is there is a more suitable place where we could submit this issue ie .net/runtime. This issue will prevent us from being able to move to maui. It does not make sense to us that the performance here should be so significantly poorer then what is seen using xamarinforms.

PureWeen commented 1 month ago

Issue moved from dotnet/maui#10103


From @Zhanglirong-Winnie on Friday, May 26, 2023 7:08:03 AM

Verified this issue with Visual Studio 17.7.0 Preview 1.0. Can repro on MAUI iOS platform with above project. Xamarin Forms iOS works fine. XmlReaderPerformance-main.zip MAUI: 10103 Xamarin Forms: 10103 XF

rolfbjarne commented 4 weeks ago

The difference between .NET iOS and MAUI is that MAUI has the interpreter enabled by default for Debug builds, and interpreter builds are slower than AOT-compiled builds.

Testing with .NET 8 (since both .NET 6 and 7 are out of support now) and a Debug build with the interpreter disabled, I get these numbers:

Which seems in line with your numbers (.NET is ~3x slower).

However, for a Release build, I get these numbers:

So .NET is 40% faster than Xamarin.Forms in this case.

As such, I don't think there's anything for us to do here.