Skip to content

🐇 Avoid making two copies of SyntaxToken at each step of the formatting operations chain#43455

Merged
sharwell merged 1 commit intodotnet:masterfrom
sharwell:lighter-operations
Apr 27, 2020
Merged

🐇 Avoid making two copies of SyntaxToken at each step of the formatting operations chain#43455
sharwell merged 1 commit intodotnet:masterfrom
sharwell:lighter-operations

Conversation

@sharwell
Copy link
Contributor

@sharwell sharwell commented Apr 17, 2020

Summary

This appears to provide a 3% improvement.

Before

BenchmarkDotNet=v0.11.4, OS=Windows 10.0.18363
AMD Ryzen Threadripper 2990WX, 1 CPU, 64 logical and 32 physical cores
  [Host]     : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4150.0
  Job-OKQBPV : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4150.0

Server=True  InvocationCount=1  UnrollFactor=1
Method Document Mean Error StdDev Gen 0/1k Op Gen 1/1k Op Gen 2/1k Op Allocated Memory/Op
FormatCSharp Bound(...)rated [24] 902.107 ms 9.0826 ms 7.5843 ms - - - 28790.46 KB
FormatVisualBasic Bound(...)rated [24] 509.950 ms 4.0274 ms 3.3631 ms 1000.0000 - - 27405.64 KB
FormatCSharp ErrorFacts.Generated 20.870 ms 0.6553 ms 1.8908 ms - - - 1274.77 KB
FormatVisualBasic ErrorFacts.Generated 9.422 ms 0.1848 ms 0.2767 ms - - - 818.09 KB
FormatCSharp Synta(...)rated [29] 2,050.614 ms 17.4836 ms 15.4987 ms 3000.0000 2000.0000 2000.0000 76187.18 KB
FormatVisualBasic Synta(...)rated [29] 2,047.467 ms 29.7898 ms 24.8759 ms 10000.0000 5000.0000 3000.0000 107066.14 KB
FormatCSharp Synta(...)rated [25] 401.977 ms 7.7503 ms 6.8704 ms 4000.0000 1000.0000 - 18084.18 KB
FormatVisualBasic Synta(...)rated [25] 1,198.173 ms 15.2435 ms 13.5130 ms 2000.0000 1000.0000 1000.0000 68622.22 KB
FormatCSharp Synta(...)rated [27] 706.526 ms 12.5824 ms 11.1540 ms - - - 27453.25 KB
FormatVisualBasic Synta(...)rated [27] 1,044.804 ms 21.0915 ms 21.6595 ms 4000.0000 2000.0000 1000.0000 58106.18 KB

After

BenchmarkDotNet=v0.11.4, OS=Windows 10.0.18363
AMD Ryzen Threadripper 2990WX, 1 CPU, 64 logical and 32 physical cores
  [Host]     : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4150.0
  Job-OKQBPV : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4150.0

Server=True  InvocationCount=1  UnrollFactor=1
Method Document Mean Error StdDev Gen 0/1k Op Gen 1/1k Op Gen 2/1k Op Allocated Memory/Op
FormatCSharp Bound(...)rated [24] 851.546 ms 6.6579 ms 6.2278 ms - - - 28776.26 KB
FormatVisualBasic Bound(...)rated [24] 512.190 ms 10.1590 ms 17.2507 ms 1000.0000 - - 27402.09 KB
FormatCSharp ErrorFacts.Generated 21.224 ms 0.6719 ms 1.9599 ms - - - 1290.78 KB
FormatVisualBasic ErrorFacts.Generated 9.483 ms 0.1850 ms 0.3141 ms - - - 810.09 KB
FormatCSharp Synta(...)rated [29] 1,975.754 ms 29.8634 ms 27.9343 ms 3000.0000 2000.0000 2000.0000 76203.13 KB
FormatVisualBasic Synta(...)rated [29] 1,987.659 ms 38.6107 ms 37.9209 ms 3000.0000 2000.0000 1000.0000 107024.45 KB
FormatCSharp Synta(...)rated [25] 382.028 ms 7.6219 ms 7.1295 ms - - - 18086.93 KB
FormatVisualBasic Synta(...)rated [25] 1,199.007 ms 23.7543 ms 36.2753 ms 4000.0000 2000.0000 1000.0000 68594.77 KB
FormatCSharp Synta(...)rated [27] 674.774 ms 6.1743 ms 5.4733 ms - - - 27475.86 KB
FormatVisualBasic Synta(...)rated [27] 1,025.651 ms 19.9862 ms 29.2956 ms 4000.0000 2000.0000 1000.0000 58130.52 KB

@sharwell sharwell requested a review from a team as a code owner April 17, 2020 19:53
@sharwell sharwell changed the title Avoid making two copies of SyntaxToken at each step of the formatting operations chain 🐇 Avoid making two copies of SyntaxToken at each step of the formatting operations chain Apr 17, 2020
@CyrusNajmabadi
Copy link
Contributor

Do we have perf numbers here? i'd like to get a sense of how this sort of thing helps. Thanks!

@sharwell
Copy link
Contributor Author

@CyrusNajmabadi perf numbers are now added above

@CyrusNajmabadi
Copy link
Contributor

Thanks!

@sharwell sharwell marked this pull request as draft April 17, 2020 21:59
@sharwell

This comment has been minimized.

@sharwell sharwell marked this pull request as ready for review April 27, 2020 18:10
@sharwell sharwell merged commit 7d2cf0d into dotnet:master Apr 27, 2020
@ghost ghost added this to the Next milestone Apr 27, 2020
@sharwell sharwell deleted the lighter-operations branch April 27, 2020 21:49
@sharwell sharwell modified the milestones: Next, temp, 16.7.P1 Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants