Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: belav/csharpier
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: deepskiesdev/csharpier
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 15 commits
  • 42 files changed
  • 3 contributors

Commits on Dec 31, 2025

  1. perf: use overload for Any( SyntaxTriviaList to prevent allocations (

    …#1703)
    
    Semi reverts #1572 which overwrote #1485, I assume this was accidental.
    I noticed that you prefer explicit `Enumerable.Any` usage, should I
    convert this PR to use `ListExtensions.Any`?
    
    
    ## Benchmarks
    Saves around 15% of memory usage
    ### Before
    | Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
    |------------------------------
    |---------:|--------:|--------:|----------:|----------:|----------:|
    | Default_CodeFormatter_Tests | 128.0 ms | 2.44 ms | 3.43 ms | 3000.0000
    | 1000.0000 | 34.57 MB |
    | Default_CodeFormatter_Complex | 260.3 ms | 5.11 ms | 7.17 ms |
    5000.0000 | 2000.0000 | 53.05 MB |
    
    
    ### After
    | Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
    |------------------------------
    |---------:|--------:|---------:|----------:|----------:|----------:|
    | Default_CodeFormatter_Tests | 126.0 ms | 2.27 ms | 5.45 ms | 2000.0000
    | 1000.0000 | 28.02 MB |
    | Default_CodeFormatter_Complex | 245.2 ms | 4.63 ms | 10.44 ms |
    4000.0000 | 2000.0000 | 43.88 MB |
    
    Co-authored-by: Bela VanderVoort <[email protected]>
    TimothyMakkison and belav committed Dec 31, 2025
    Configuration menu
    Copy the full SHA
    f3a4a9a View commit details
    Browse the repository at this point in the history
  2. perf: add Doc.Null check to Argument avoids Concat creation (#1706

    )
    
    Add check for if `modifiers` are `Doc.Null` to avoid allocating a
    `Concat` and `Doc[]`
    
    
    ### Benchmarks (timing is inaccurate)
    #### Before
    | Method | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
    |------------------------------
    |---------:|--------:|--------:|---------:|----------:|----------:|----------:|
    | Default_CodeFormatter_Tests | 131.9 ms | 3.30 ms | 8.86 ms | 128.0 ms
    | 3000.0000 | 1000.0000 | 34.57 MB |
    | Default_CodeFormatter_Complex | 261.3 ms | 5.16 ms | 4.03 ms | 261.3
    ms | 5000.0000 | 2000.0000 | 53.03 MB |
    
    
    #### After
    | Method | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
    |------------------------------
    |---------:|---------:|---------:|---------:|----------:|----------:|----------:|
    | Default_CodeFormatter_Tests | 189.5 ms | 10.25 ms | 28.05 ms | 195.6
    ms | 3000.0000 | 1000.0000 | 34.31 MB |
    | Default_CodeFormatter_Complex | 264.2 ms | 5.27 ms | 13.97 ms | 260.0
    ms | 5000.0000 | 2000.0000 | 52.31 MB |
    
    Co-authored-by: Bela VanderVoort <[email protected]>
    TimothyMakkison and belav committed Dec 31, 2025
    Configuration menu
    Copy the full SHA
    87b7152 View commit details
    Browse the repository at this point in the history
  3. perf: use Stack.Peek to reduce Pop and Push churn (#1708)

    Not sure if more changes might help here, perhaps calling
    `docsStack.Push(TraverseDocOnExitStackMarker);` later and adding an
    `else` clause might help, that or using a goto. Might be easier to
    measure an improvement once other changes were made.
    
    Did wonder if `ValueListBuilder` will help due to faster `Push` and
    `Pop`.
    
    Co-authored-by: Bela VanderVoort <[email protected]>
    TimothyMakkison and belav committed Dec 31, 2025
    Configuration menu
    Copy the full SHA
    cd499af View commit details
    Browse the repository at this point in the history
  4. perf: set capacity of List in MembersForcedLine (#1709)

    Most `result` Lists are always just under `3 * members.Count`, small
    change but simple 🤷
    
    
    ### 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 | 132.4 ms | 2.64 ms | 3.87 ms | 3000.0000
    | 1000.0000 | 34.56 MB |
    | Default_CodeFormatter_Complex | 268.2 ms | 4.92 ms | 4.60 ms |
    5000.0000 | 2000.0000 | 52.78 MB |
    
    Co-authored-by: Bela VanderVoort <[email protected]>
    TimothyMakkison and belav committed Dec 31, 2025
    Configuration menu
    Copy the full SHA
    192ecd1 View commit details
    Browse the repository at this point in the history
  5. perf: optimise SyntaxNodeComparer (#1730)

    It appears that `SyntaxNodeComparer` is run after a file is formated,
    optimisation here may be impactful
    
    - Prevent null `Func<T, T, Result>` allocations (still seeing some in
    the profiler, no idea how to sotp this)
    - Prevent boxing of `SyntaxTokenList`, `SyntaxNodeOrTokenList`
    - Use `OrderBy.ToArray` instead of `OrderBy.ToList`
    - Create `AllSeparatorsButLast` to prevent boxing
    `SeparatedSyntaxList<SyntaxNode>` and `IEnumerable` creation
    
    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 <[email protected]>
    TimothyMakkison and belav committed Dec 31, 2025
    Configuration menu
    Copy the full SHA
    350c7fe View commit details
    Browse the repository at this point in the history
  6. perf: fast comparison using FullSpan and source code (#1737)

    - Compare the old and formatted code before using `SyntaxNodeComparer`
    (ie new version of csharpier, no changes but hash is cache is
    invalidated)
    - Skip comparison if two `TypeDeclaration` aka (classes, struct,
    interfaces etc) or `MethodDeclaration` are identical
    - This could be done for all `SyntaxNodes` but may slow things down if
    most nodes have changed
    
    The CLI spends up to 30% of the time doing comparisons, with this, we
    can skip cases with identical source code, and only compare
    types/methods that have changed. The performance degradation for lots of
    changes (i.e. first time a project is formatted) shouldn't be that great
    as `CompareFullSpan` is basically a fast `SequenceEqual` and only used
    for type declarations and methods.
    
    Co-authored-by: Bela VanderVoort <[email protected]>
    TimothyMakkison and belav committed Dec 31, 2025
    Configuration menu
    Copy the full SHA
    c087368 View commit details
    Browse the repository at this point in the history
  7. perf: cache IgnoreWithBasePath (#1758)

    Repeatedly compiling regex for ignore files is a significant amount of
    runtime, caches the `IgnoreWithBasePath` to prevent this. See also #1776
    
    
    ### Before
    | Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
    |----------
    |---------:|---------:|---------:|----------:|----------:|----------:|
    | FormatCli | 955.0 ms | 17.65 ms | 29.98 ms | 9000.0000 | 1000.0000 |
    81.5 MB |
    
    
    ### After
    
    | Method    | Mean     | Error    | StdDev   | Gen0      | Allocated |
    |---------- |---------:|---------:|---------:|----------:|----------:|
    | FormatCli | 683.5 ms | 13.61 ms | 30.17 ms | 7000.0000 |  69.33 MB |
    
    Co-authored-by: Bela VanderVoort <[email protected]>
    TimothyMakkison and belav committed Dec 31, 2025
    Configuration menu
    Copy the full SHA
    f9a3b14 View commit details
    Browse the repository at this point in the history
  8. Adding the xml whitespace options (#1793)

    This is just adding the options that will eventually be used by the new
    xml whitespace handling code.
    belav committed Dec 31, 2025
    Configuration menu
    Copy the full SHA
    ff79092 View commit details
    Browse the repository at this point in the history

Commits on Jan 1, 2026

  1. Configuration menu
    Copy the full SHA
    838b331 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2026

  1. Update bug report template with playground link

    Added a reminder for users to recreate formatting issues on the playground.
    belav authored Jan 19, 2026
    Configuration menu
    Copy the full SHA
    cbe200c View commit details
    Browse the repository at this point in the history
  2. Add axaml to VS. Bump up version number on all plugins to try to help…

    … with people not realizing they are versioned differently.
    belav committed Jan 19, 2026
    Configuration menu
    Copy the full SHA
    7d939ba View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e1ff536 View commit details
    Browse the repository at this point in the history
  4. Improve version check formatting in bug.yml

    Updated formatting for version checks in bug report template.
    belav authored Jan 19, 2026
    Configuration menu
    Copy the full SHA
    9f870a7 View commit details
    Browse the repository at this point in the history
  5. Revise bug report template for clarity and versioning

    Updated the bug report template to include checkboxes for user confirmation and added specific version numbers for CSharpier.
    belav authored Jan 19, 2026
    Configuration menu
    Copy the full SHA
    ff9ad30 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    aba100e View commit details
    Browse the repository at this point in the history
Loading