question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build perf is negatively impacted

See original GitHub issue

Running PerfView during the build of the PInvoke project, I see that almost a full second goes to the GetBuildVersion task, which seems to be doing some repeat work perhaps within the same task execution, and certainly across projects. Can we cache the results across projects?

Name                                                                                                                                                            	Inc %	   Inc
 nerdbank.gitversioning.tasks!GetBuildVersion.Execute                                                                                                           	  2.2	   939
+ nerdbank.gitversioning!VersionOracle.Create                                                                                                                   	  2.2	   935
|+ nerdbank.gitversioning!Nerdbank.GitVersioning.VersionOracle..ctor(class System.String,class LibGit2Sharp.Repository,class Nerdbank.GitVersioning.ICloudBuild)	  2.2	   919
||+ nerdbank.gitversioning!GitExtensions.GetVersionHeight                                                                                                       	  0.9	   381
||+ nerdbank.gitversioning!GitExtensions.GetIdAsVersion                                                                                                         	  0.8	   340
||+ nerdbank.gitversioning!VersionFile.GetVersion                                                                                                               	  0.4	   181

Opportunities:

  • Add an incremental build aspect to the GetBuildVersion target where the results are saved to a file with the cache key being the tuple: version.json timestamp (and path?) and commit id. (@japj’s idea)
  • Cache the height for one or more commits so even if the commit advances, we quickly find a commit whose height was predetermined in the cache file and cut off the potentially long git history traversal (@djluck’s idea)
  • #508 Cut down on redundant GetBuildVersion executions per-project that @djluck identified, possibly by using the MSBuild task call to invoke another target but with a reduced set of global properties to improve target skipping around P2P and TargetFramework invocations.
  • #508 Build on the shared MSBuild target invocation within a single project to share it across projects based on a project property that specifies the directory path for which version.json will be searched for and used as the ‘cache key’ for reuse. This key can be a global property in the MSBuild task invocation to automatically cache at the right level, and this same property can serve as the input for the version.json search.
  • #507 Never parse the same version.json content twice
  • Tell libgit2sharp to diff without considering file renames per @djluck’s comment.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:36 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
AArnottcommented, Sep 4, 2020

I’m preparing a change that should bring the number of GetBuildVersion invocations from (projects * targetframeworks) to just (projects) (which should help @djluck) and down to exactly 1 when there is just one version.json file in the repo and the repo ‘opts in’ to sharing version info across projects.

1reaction
filipnavaracommented, Sep 7, 2020

I tried version 3.3.22-alpha with the added GitVersionBaseDirectory property and I no longer see the GetBuildVersion task in the MSBuild performance traces at all; neither for the full rebuild nor for the incremental one. There are two invocations of GetBuildVersionCore that together consume around 126ms of time:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

4.8. About Perf Red Hat Enterprise Linux for Real Time 7
Sampling at too high a frequency can negatively impact the performance of your real-time system. Previous · Next ...
Read more >
Troubleshoot build performance with Build Analyzer
You can use this information to determine whether unexpected dependency downloads are negatively impacting your build performance.
Read more >
Performance-enhancing drugs: Know the risks
Testosterone has two main effects on the body: Helps build muscle. Causes features such as facial hair and a deeper voice. The anabolic...
Read more >
Profile your build | Android Studio
Learn how to profile your build to help optimize build speed. ... might negatively impact performance on low-memory machines.
Read more >
How Brand Building and Performance Marketing Can Work ...
We know that performance marketing can have a profound impact—positive or negative—on a brand. Our three brand owners have taken steps to ensure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found