Skip to content

Conversation

@TimothyMakkison
Copy link
Contributor

@TimothyMakkison TimothyMakkison commented Oct 17, 2025

Pass values function arguments instead of capturing them in a closure.

Not sure why Func is used here. I'm assuming that it's delibrately deferring the calculation because PrintingContext might change? IIRC calculating indentifier eagerly didn't cause any tests to fail.

Benchmarks (timing is inaccurate should be the same)

Before

Method Mean Error StdDev Gen0 Gen1 Allocated
Default_CodeFormatter_Tests 133.0 ms 2.56 ms 2.84 ms 3000.0000 1000.0000 34.58 MB
Default_CodeFormatter_Complex 271.5 ms 5.40 ms 7.92 ms 5000.0000 2000.0000 52.95 MB

After

Method Mean Error StdDev Gen0 Gen1 Allocated
Default_CodeFormatter_Tests 129.9 ms 2.16 ms 3.24 ms 3000.0000 1000.0000 34.55 MB
Default_CodeFormatter_Complex 260.5 ms 5.15 ms 7.55 ms 5000.0000 2000.0000 52.64 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