Skip to content

Fcs profiling util #2312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 27, 2017
Merged

Conversation

vasily-kirichenko
Copy link
Contributor

@vasily-kirichenko vasily-kirichenko commented Jan 22, 2017

This utility console does the following:

  • <C>: ParseAndCheckProject fro FSharp.Compiler.Service project (not the similar one from this repo, but the other one, from FCS NuGet is built)
  • <G>: GC.Collect(2)

usage:

LanguageServiceProfiling <path to FSharp.Compiler.Server repository>

I've failed to use or port FSharpProjectCracker, so I logged FSharpProjectOptions right in running VS and copy it into Options.fs file.

Interesting things so far:

  • first check = 0:54, second (after adding a space into NameResolution.fs) - 3:42 (!)
  • absolutely no memory leaks between runs

@vasily-kirichenko
Copy link
Contributor Author

vasily-kirichenko commented Jan 22, 2017

This is one of subsequent checking:

image

The memory at the peaks is a little bit higher than 1GB.
@dsyme It looks like it does checking twice? May it be wrongly triggered StartBackgroundCompilation?

@vasily-kirichenko
Copy link
Contributor Author

Hmm, cannot reproduce 0:52 result for first run anymore :( 3:04 now...

smoothdeveloper and others added 4 commits January 22, 2017 13:41
* change target framework (so can build with vs2015)
* change to x86
* add <W> and <M> keys to waste some memory (loads 100mb array and put it in a resizearray) or reclaim waste (clear the resizearray) for extra memory pressure
minor changes to LanguageServiceProfiling:
printfn "ParseAndCheckFileInProject(%s)..." relativePath
let filePath = Path.Combine(rootDir, relativePath)
let sw = Stopwatch.StartNew()
let _, answer = checker.ParseAndCheckFileInProject(filePath, fileVersion, File.ReadAllText filePath, options) |> Async.RunSynchronously
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to add some options to perform some GetDeclarations, GetToolTip calls and the FCS calls needed to support find-all-references

@dsyme
Copy link
Contributor

dsyme commented Jan 22, 2017

@vasily-kirichenko Super work, a great start towards getting a firmer grip on memory usage.

@saul
Copy link
Contributor

saul commented Jan 22, 2017

This is fantastic - I know it's something that Don's been keen to see for a while based on his GH comments.

This would be really useful to put into CI if there's a way to automate it too - it would be useful to know that some of the core FCS functions are not increasing in memory usage and we can finally reproducibly quantify this resource consumption. Great job 🥇

@smoothdeveloper
Copy link
Contributor

Not related to this utility, but in a large solution (with only a handful of F# projects), having F# projects with large number of assembly references (from 3rd part vendors), ILBinaryReader.ILReaderContext seems to be high in the list.

image

image

(this is VS2015 and I have VFPT installed)

My guess is that it is common industry usage to have F# projects with a significant amount of dependencies, it might be worth to look at the memory occupied by the assembly reader and see if there aren't some obvious gains pending there.

Ideally that should be shared with representation used by C#/VB.NET projects (understanding that some extra structures are necessary for specificities of each language) as I'm using the same assembly references in many projects.

@@ -114,6 +114,17 @@ type internal ProjectInfoManager
member this.UpdateProjectInfo(projectId: ProjectId, site: IProjectSite, workspace: Workspace) =
let extraProjectInfo = Some(box workspace)
let options = ProjectSitesAndFiles.GetProjectOptionsForProjectSite(site, site.ProjectFileName(), extraProjectInfo, serviceProvider)

//lock this <| fun _ ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vasily-kirichenko
Could we have a comment describing why this code is commented out. It is fair to say that we all know why it is commented out right now ... but in the future we may have forgotten.

We could also consider using the preprocessor to disable it rather than using comments too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

change LanguageServiceProfiling util target framework to 4.6
@KevinRansom KevinRansom merged commit 08520be into dotnet:master Jan 27, 2017
@KevinRansom
Copy link
Contributor

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants