Skip to content

[Code Optimization] Memory issue in Enumerable.ToList #42

Description

@CarlosCampos06

Description: A lot of CPU or Memory is being spent in IEnumerable<T>.ToList().

Current condition: 68.3734377722759 of your Memory was spent in Enumerable.ToList called from Store.Reviews.ReviewValidation.StringValidation. We expected this value to be <13%.

Recommendations: Consider using List<T> from the start to avoid expensive calls to ToList(). Also, verify that IEnumerable<T>.ToList() isn't being...

Instructions for performance issue

Fix the perf issue by changing only non-test files.
Steps:

  1. Review repo, understand structure.
  2. Create Benchmark Tests - Use BenchmarkDotNet + MemoryDiagnoser. Create .csproj, run with latest .NET.
  3. Fix & optimize problematic method, cover edge cases.
  4. Rerun benchmark + unit tests to verify perf and correctness.
  5. In PR Explain fix - what you considered, implemented, and why.
  6. Post performance results as table in PR comment before/after fix. Add a short description of code changes into PR.
  7. Rename PR – Format: 'method

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions