perf: optimise SyntaxNodeComparer by TimothyMakkison · Pull Request #1730 · belav/csharpier (original) (raw)

@TimothyMakkison

@belav

belav added a commit that referenced this pull request

Dec 31, 2025

@TimothyMakkison @belav

It appears that SyntaxNodeComparer is run after a file is formated, optimisation here may be impactful

I have some other idea, but I'm focusing on the unhappy path right now.

Benchmark (comparing complexCode)

Before

| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated | |--------------------------- |---------:|--------:|--------:|----------:|----------:|----------:|----------:| | Default_SyntaxNodeComparer | 229.1 ms | 4.55 ms | 7.60 ms | 5000.0000 | 3000.0000 | 1000.0000 | 40.53 MB |

After

| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | |--------------------------- |---------:|--------:|--------:|----------:|----------:|----------:| | Default_SyntaxNodeComparer | 187.4 ms | 3.51 ms | 7.64 ms | 3000.0000 | 1000.0000 | 31.39 MB |

Co-authored-by: Bela VanderVoort twobitbela@gmail.com

belav added a commit that referenced this pull request

Feb 20, 2026

@TimothyMakkison @belav

It appears that SyntaxNodeComparer is run after a file is formated, optimisation here may be impactful

I have some other idea, but I'm focusing on the unhappy path right now.

Benchmark (comparing complexCode)

Before

| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated | |--------------------------- |---------:|--------:|--------:|----------:|----------:|----------:|----------:| | Default_SyntaxNodeComparer | 229.1 ms | 4.55 ms | 7.60 ms | 5000.0000 | 3000.0000 | 1000.0000 | 40.53 MB |

After

| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | |--------------------------- |---------:|--------:|--------:|----------:|----------:|----------:| | Default_SyntaxNodeComparer | 187.4 ms | 3.51 ms | 7.64 ms | 3000.0000 | 1000.0000 | 31.39 MB |

Co-authored-by: Bela VanderVoort twobitbela@gmail.com

belav added a commit that referenced this pull request

Mar 12, 2026

@TimothyMakkison @belav

It appears that SyntaxNodeComparer is run after a file is formated, optimisation here may be impactful

I have some other idea, but I'm focusing on the unhappy path right now.

Benchmark (comparing complexCode)

Before

| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated | |--------------------------- |---------:|--------:|--------:|----------:|----------:|----------:|----------:| | Default_SyntaxNodeComparer | 229.1 ms | 4.55 ms | 7.60 ms | 5000.0000 | 3000.0000 | 1000.0000 | 40.53 MB |

After

| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | |--------------------------- |---------:|--------:|--------:|----------:|----------:|----------:| | Default_SyntaxNodeComparer | 187.4 ms | 3.51 ms | 7.64 ms | 3000.0000 | 1000.0000 | 31.39 MB |

Co-authored-by: Bela VanderVoort twobitbela@gmail.com

belav added a commit that referenced this pull request

Apr 4, 2026

@TimothyMakkison @belav

It appears that SyntaxNodeComparer is run after a file is formated, optimisation here may be impactful

I have some other idea, but I'm focusing on the unhappy path right now.

Benchmark (comparing complexCode)

Before

| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated | |--------------------------- |---------:|--------:|--------:|----------:|----------:|----------:|----------:| | Default_SyntaxNodeComparer | 229.1 ms | 4.55 ms | 7.60 ms | 5000.0000 | 3000.0000 | 1000.0000 | 40.53 MB |

After

| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | |--------------------------- |---------:|--------:|--------:|----------:|----------:|----------:| | Default_SyntaxNodeComparer | 187.4 ms | 3.51 ms | 7.64 ms | 3000.0000 | 1000.0000 | 31.39 MB |

Co-authored-by: Bela VanderVoort twobitbela@gmail.com

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})