Skip to content

Caching loaded template lines to improve performance#345

Open
pavel-trafimuk wants to merge 2 commits intostencilproject:masterfrom
pavel-trafimuk:master
Open

Caching loaded template lines to improve performance#345
pavel-trafimuk wants to merge 2 commits intostencilproject:masterfrom
pavel-trafimuk:master

Conversation

@pavel-trafimuk
Copy link

Currently, Stencil load and parse template file for each new output file generation,
this improve help to reduce repetitive logic and significantly improve performance (on 30-50%)

@art-divin
Copy link
Contributor

cc @djbe

@tothambrus11
Copy link

tothambrus11 commented Jun 12, 2024

Hello, can somebody review this PR? This change seems to be very useful for our project at Hylo, where we generate thousands of pages for the documentation of the standard library using Stencil.

To my understanding, this would be a breaking change, as the caches require the generator functions to be mutating. In swift there might be a way to opt out of the strict value semantics and make the cache a mutable field that is not part of the object's value, something like the mutable keyword for struct members in C++ that allows the field to be mutated from a const function, thus allowing the introduction of caches with const API.

@pavel-trafimuk
Copy link
Author

@tothambrus11 seems like repo is not maintenaning anymore. this improved already implemented in https://github.com/art-divin/StencilSwiftKit.git and https://github.com/art-divin/StencilSwiftKit.git and finally in Sourcery and it was checked by time.

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.

3 participants