Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small optimization in TaxonomyService #8775

Merged

Conversation

MatteoPiovanelli-Laser
Copy link
Contributor

Memorize results of queries to prevent repeated execution within a request.
We noticed a few instances where the same query would be invoked several times in the same request. For example, when several contentItems of a same contentType are in the same list.

This allows skipping a few of those queries.

}

public ILogger Logger { get; set; }
public Localizer T { get; set; }

private IEnumerable<TaxonomyPart> _taxonomies;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private IEnumerable<TaxonomyPart> _taxonomies;
private List<TaxonomyPart> _taxonomies;

Since the type is known and this is a private member

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless it's not what the method returns

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IContentQuery<T>.List() (which is what's assigned and eventually returned here) returns an IEnumerable<T>. Definitely not a List<T>.

@MatteoPiovanelli-Laser MatteoPiovanelli-Laser merged commit 4a05e77 into OrchardCMS:dev Mar 15, 2024
2 checks passed
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.

2 participants