gls icon indicating copy to clipboard operation
gls copied to clipboard

profile gls binary with pprof to spot bottlenecks in runtime

Open ozansz opened this issue 2 years ago • 0 comments

Summary

Folder indexing (tree traversal) seems to be inefficient than it should be, considering it's basically a tree traversal algorithm. Use pprof tool to find out if there are any bottlenecks in the code, by either:

  1. Writing a benchmark test and running it with the -benchmem, -memprofile, and -cpuprofile options
  2. Setting up a pprof server by using net/http/pprof, and calling it during runtime to capture the CPU/memory dumps

ozansz avatar Oct 08 '22 16:10 ozansz

I'm having the same issue.

caldrian avatar Jun 23 '21 11:06 caldrian

@visuall @caldrian how can you reproduce that?

Are the dylibs inside the .app/Frameworks or in .IPA/SwiftSupport that are missing?

Are you using the Archive for Publishing or the "generate IPA" build option?

Flash3001 avatar Jun 29 '21 12:06 Flash3001

@Flash3001 , I am using Archive for Publishing. The dylibs are not in .app/Frameworks.

visuall avatar Jun 30 '21 06:06 visuall

Looks like Xamarin now removes Headers folder in each framework during the build process. The CheckSwiftVersionsTask does not detect a swift header and thinks the framework isn't depending on swift libraries. The workaround I came up with is to apply "true" value to the _ShouldIncludeSwiftDylibs variable inside the target and not re-apply it in Output tags. Take a look at modified file: https://gist.github.com/ololomax/1e72c65c5d69ae092c22c52aa2b45f73 (you should replace your packages/Xamarin.Swift.1.0.7/build/xamarinios/Xamarin.Swift.targets with this one).

ololomax avatar Jul 16 '21 10:07 ololomax

My support for this project has been awful lately, sorry about that.

I just published @ololomax changes as 1.0.8. That means that even if you target a version of iOS that already includes the Swift runtime the files will still be included in your bundle.

I was having a hard time trying to reproduce the issue. Turns out the X-Swift.h headers are removed only on Release builds.

My goal for now was to only provide the workaround so you don't need to keep changing the Nuget download folder.

I still need to stop and think about what to do. Microsoft published a package on NuGet with the same functionality (Xamarin.iOS.SwiftRuntimeSupport) and I have yet to test it and see how it behaves alongside this one.

We may have 3 options: A) Stop this project and delegate all functions to the official Microsoft package using the Nuget dependency feature. B) Find a workaround to get the required Swift version and continue with the same functionality. C) Keep the current workaround, which will always include the Swift runtime.

Flash3001 avatar Jul 19 '21 17:07 Flash3001