MelGrubb / BuilderGenerator

A source-generator-based implementation of the Builder pattern
https://melgrubb.github.io/BuilderGenerator/
MIT License
36 stars 8 forks source link

Enhance performance #27

Closed MelGrubb closed 1 year ago

MelGrubb commented 1 year ago

Create a specialized type to return from the Transform method.

The idea is to speed up the time needed to find and verify items in the generator cache. Caching based on the entire semantic node would potentially re-trigger generation when items like comments, private fields, or methods are modified, but the generator's output would only be affected by changes made to the public (and possibly internal) properties. By accepting the syntax node in the constructor, it should be possible to extract only what's needed, and pre-compute the instance hash just once, so that subsequent comparisons won't have any work to do.