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

Save byte array allocations #15630

Merged
merged 2 commits into from
Apr 2, 2024
Merged

Save byte array allocations #15630

merged 2 commits into from
Apr 2, 2024

Conversation

sebastienros
Copy link
Member

No description provided.

@sebastienros sebastienros requested a review from jtkech as a code owner March 29, 2024 23:31
@@ -3,7 +3,7 @@
@inject IContentManager ContentManager

@{
var matchAllQuery = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(@"SELECT * FROM ContentItemIndex"));
var matchAllQuery = OrchardCore.Queries.Sql.ViewModels.AdminQueryViewModel.MatchAllQueryBase64;
Copy link
Member

@hishamco hishamco Mar 30, 2024

Choose a reason for hiding this comment

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

Suggested change
var matchAllQuery = OrchardCore.Queries.Sql.ViewModels.AdminQueryViewModel.MatchAllQueryBase64;
var matchAllQuery = Model.MatchAllQueryBase64;

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not part of the usings

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I mean to use the model, I updated the above suggestion

Copy link
Member Author

Choose a reason for hiding this comment

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

Static properties can't be accessed from instance references.

@@ -6,6 +6,8 @@ namespace OrchardCore.Queries.Sql.ViewModels
{
public class AdminQueryViewModel
{
public static string MatchAllQueryBase64 { get; } = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(@"SELECT * FROM ContentItemIndex"));
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
public static string MatchAllQueryBase64 { get; } = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(@"SELECT * FROM ContentItemIndex"));
public static string MatchAllQueryBase64 => Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(@"SELECT * FROM ContentItemIndex"));

Copy link
Member Author

Choose a reason for hiding this comment

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

That would evaluate on each call. Which was done before this change.

@sebastienros sebastienros merged commit aa0b8c3 into main Apr 2, 2024
5 checks passed
@sebastienros sebastienros deleted the sebros/bytearray branch April 2, 2024 22:03
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