Closed caendesilva closed 1 year ago
it would ...[] serve as a global performance guard
In practise, this doesn't really have an effect. Benchmarking the method shows that it takes between 1 and 1.3 milliseconds on my machine to discover publication types (1.8~5.8ms on cold boot), and about 15 ms on cold boot to discover publications. So about 20ms for 4 types and 15 pages. That's a very small performance consideration unlikely to make a noticable difference.
it would make tag matching coding simpler
This here is the reason this issue will be implemented, as it is indeed easier to work with data stored in memory.
Resolved in https://github.com/hydephp/develop/pull/1138
Proposal for PublicationService
Any objections to caching publications (in a local static variable) in
PublicationService::getPublicationsForType()
?I'm asking because it would make tag matching coding simpler and serve as a global performance guard. Since the publications won't change in a single build request, it should not affect the correctness of the function.