Skip to content

perf: prevent boxing SyntaxTokenList by calling ToArray earlier#1873

Open
TimothyMakkison wants to merge 1 commit into
belav:mainfrom
TimothyMakkison:modifier_to_array
Open

perf: prevent boxing SyntaxTokenList by calling ToArray earlier#1873
TimothyMakkison wants to merge 1 commit into
belav:mainfrom
TimothyMakkison:modifier_to_array

Conversation

@TimothyMakkison

Copy link
Copy Markdown
Contributor

Prevent boxing SyntaxTokenList by moving the ToArray call to be earlier.
Renamed to modifierArray to reflect the fact its not sorted yet, and later create a local variable called sortedModifiers

Benchmarks - small memory saving timing is inaccurate

Before

Method Mean Error StdDev Median Gen0 Gen1 Gen2 Allocated
Default_CodeFormatter_Tests 198.9 ms 9.40 ms 26.98 ms 202.2 ms 2000.0000 1000.0000 - 28.8 MB
Default_CodeFormatter_Complex 336.0 ms 7.01 ms 20.23 ms 325.7 ms 5000.0000 2500.0000 500.0000 47.64 MB

After

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
Default_CodeFormatter_Tests 218.6 ms 20.83 ms 61.08 ms 2000.0000 1000.0000 - 28.77 MB
Default_CodeFormatter_Complex 300.4 ms 5.94 ms 10.25 ms 5000.0000 3000.0000 1000.0000 47.42 MB

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.

1 participant