Skip to content

System.Resources.Resx code readability and style issues #216

Closed

Description

@Liminiens

Problem description:

Currently there is an issue with code style consistency in System.Resources.Resx... family (like using BCL types instead of keywords), and in some places the readability of the code could be improved. For example, use foreach instead of for, or remove redundant else conditions. Also some patterns like str != null && str.Length > 0, or .Equals can be simplified.

Activity

  1. zsd4yr commented on Dec 10, 2018

    @zsd4yr
    Contributor

    I realize the specific example of for versus foreach is not the primary point of this post, but I wanted to chime in and say that there are certainly cases where you might sacrifice some readability for better performing code.

    For example, for loops on List are a bit more than 2 times cheaper than foreach loops on List. This is also the case with arrays.

    So it may become important to delve more deeply into these issues. Premature optimization is certainly a root of evil here, so the discussion may require some conjecture about the existing code's performance as well as how closely these code paths are to core behaviors.

  2. KlausLoeffelmann commented on Dec 10, 2018

    @KlausLoeffelmann
    Member
  3. zsd4yr commented on Dec 10, 2018

    @zsd4yr
    Contributor

    Absolute. I would even go so far to say: Before we would accept PRs which 'optimize' code in terms of standards/readability, we'd need benchmark proof that the modification doesn't hurt performance.

    @KlausLoeffelmann I think that should not be necessary for this particular PR, as I've gone through it manually and can guarantee the benefit here. However, I agree that we absolutely need bench marking of our current performance. We have this anecdotally on a few applications but not anywhere approaching the law of large numbers nor with any real confidence about the most important / frequently-hit code paths

  4. added
    enhancement
    on Dec 10, 2018
  5. added this to the Future milestone on Dec 10, 2018
  6. modified the milestones: Future, 3.0 - Preview 4 on Apr 23, 2019
  7. ghost locked as resolved and limited conversation to collaborators on Feb 8, 2022
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions