Skip to content

[3.0] Improve generator performance#2567

Draft
Exanite wants to merge 12 commits intodotnet:develop/3.0from
Exanite:feature/performance
Draft

[3.0] Improve generator performance#2567
Exanite wants to merge 12 commits intodotnet:develop/3.0from
Exanite:feature/performance

Conversation

@Exanite
Copy link
Copy Markdown
Member

@Exanite Exanite commented Apr 13, 2026

Summary of the PR

(WIP)

This branch will be where I investigate performance improvements to the Silk 3.0 bindings generator.

Related issues, Discord discussions, or proposals

Discord thread for discussing development: https://discord.com/channels/521092042781229087/1493337581805371432

Further Comments

Tasks

  • Update ClangSharp
  • Optimize renamer
    • Track relevant identifiers and only resolve symbols for relevant identifiers instead of for all identifiers
  • Optimize PrettifyNames
    • Optimize document rename path conflict detection
  • Consider removing NormalizeWhitespace calls where possible
  • Look into using .NET profile optimization: https://learn.microsoft.com/en-us/dotnet/api/system.runtime.profileoptimization?view=net-10.0
    • This will speed up sequential runs by recording what the JIT should compile first
    • This is an easy 2 line code change, but I'd like to cleanup how constants/paths are handled in the codebase first
    • Add SilkConstants class to generator
      • Ideally all magic numbers and constants are consolidated here and documented.

Exanite added 12 commits April 14, 2026 19:08
These were written before I installed the CSharpier plugin so they were not formatted.
GetTypeInfo should be unnecessary since it gets the type of an expression.

For non-type expressions (eg: `5` is an int), this isn't useful for us.
This is arguably an indirect reference to int, but the current Silk generator only cares about modifying direct references.

For type expressions (eg: `int` refers to int), GetSymbolInfo will also return the same symbol.
*Roslyn already caches this internally. This is mainly for avoiding the async method call.
Difference is probably not measurable, but theoretically this is faster.
Conflict checking was O(n), now it is O(1).
This is to prevent false negatives from mismatched path formats.
@Exanite Exanite force-pushed the feature/performance branch from a934c2b to 878a90f Compare April 14, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant