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

🔬Research for optimization opportunities #744

Open
3 of 5 tasks
CalvinWilkinson opened this issue Sep 22, 2023 · 0 comments
Open
3 of 5 tasks

🔬Research for optimization opportunities #744

CalvinWilkinson opened this issue Sep 22, 2023 · 0 comments
Assignees
Labels
medium-priority Medium Priority 🔬research Research collection / investigation

Comments

@CalvinWilkinson
Copy link
Member

CalvinWilkinson commented Sep 22, 2023

Complete The Item Below

  • I have updated the title without removing the 🔬 emoji.

What To Research

Search for the following optimization opportunities and if any are found, create an issue to do the work.

We also need to find a standardized way to mark areas and/or lines of code so that they are optimized. This way in the future, it is obvious that it is optimized but will also prevent accidental regression of the optimization.
Look for a tool out there that helps with this kind of thing.

Ideas:

  1. Maybe this can come in the form of an analyzer.
  2. Use of an attribute to mark a method or prop and see if there is an ability to use reflection to get the code from the method or prop and it can then be performed to a previous version in the form of a text file that is committed to the repository. The problem with this approach is finding a way to create an IDE warning out of it but this probably comes back to the analyzer approach and we would need to create a custom one.

Worst-case scenario, a specialized command with a description like jetbrains warning suppression comments would work.

  1. Text splitting optimization text.Split(new[] { ',', ' '})

    Note
    This is about making sure that array instantiation of unchanging arrays is not occurring in the parameter of the Split() method.
    If so, then these arrays can be cached as a readonly array as a class field.

    • Youtube link to perf update 👉🏻 perf video(5m35s)
  2. Virtual method optimization.

    Note
    This is about setting a variable of type parent class to a class that inherits from the parent
    An example would be Parent myParent = new Child(); when public class Child : Parent { }

    • Youtube link to perf update 👉🏻 perf video(8m52s)
    • Warning: CA1859: Change type of field from 'Parent' to 'Child' for improved performance
  3. Array casting optimization

    Note
    This is all about using array casting with Cast<T> and OfType<T>.

    • Youtube link to perf update 👉🏻 perf video(8m52s)
    • JetBrains Rider warning 👉🏻 Suspicious cast: there is no type in the solution which is inherited from both 'int' and 'string'. This can occur if you had this 👉🏻 var test = new int[] { 1 }.Cast<string>();
    • In dotnet 8, this is going to be a new warning 👉🏻 CA2021: Type 'int' is incompatible with type 'string' and cast attempts will throw InvalidCastException at runtime.
  4. Watch this video and see if we can optimize perf using any of these items.

Research Results

No response

Acceptance Criteria

This issue is finished when:

  • Research complete and issues created (if needed).
  • If any issues were created, they have been added to the Related Work section below.

ToDo Items

  • Priority label added to this issue. Refer to the Priority Type Labels section below.

Issue Dependencies

No response

Related Work

No response

Additional Information:

Priority Type Labels

Priority Type Label
Low Priority low priority
Medium Priority medium priority
High Priority high priority

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@CalvinWilkinson CalvinWilkinson added 🔬research Research collection / investigation medium-priority Medium Priority labels Sep 22, 2023
@CalvinWilkinson CalvinWilkinson self-assigned this Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium-priority Medium Priority 🔬research Research collection / investigation
Projects
Status: ⚪Not Set
Development

No branches or pull requests

1 participant