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

DataGrid: optimize utility allocations #5959

Open
stsrki opened this issue Jan 30, 2025 · 0 comments
Open

DataGrid: optimize utility allocations #5959

stsrki opened this issue Jan 30, 2025 · 0 comments
Assignees
Labels
Type: Feature ⚙ Request or idea for a new feature.
Milestone

Comments

@stsrki
Copy link
Collaborator

stsrki commented Jan 30, 2025

We need to reuse constant utility values by creating read-only, or const members in code. The main problem with too many utilities is that for heavy components like DataGrid, it will allocate a new instance of each "fluent" method on each render. Usually, this is not a problem for simple use cases.

For example for:

  • Display="Display.None" we can have Display="Constants.DisplayNone"
  • Margin="@Blazorise.Margin.Is1.FromEnd" we can have Margin="Constants.Margin1FromEnd"

Where:

static class Constants
{
    public static readonly IFluentDisplay DisplayNone = Display.None;

    public static readonly IFluentSpacing Margin1FromEnd = Margin.Is1.FromEnd;

    // etc.
}
@stsrki stsrki added this to the 2.0 milestone Jan 30, 2025
@github-project-automation github-project-automation bot moved this to No Status in Development Jan 30, 2025
@stsrki stsrki added the Type: Feature ⚙ Request or idea for a new feature. label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature ⚙ Request or idea for a new feature.
Projects
Status: No Status
Development

No branches or pull requests

2 participants