Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unecessary allocations in HashSet<T> #138

@jnyrup

Description

@jnyrup

Description

HashSet<T> contains three calls to string.Format in non-invariant checking methods.

Logger.Log(string.Format(string.Format("Expand to {0} bits", bits + 1)));

Logger.Log(string.Format(string.Format("Resize to {0} bits", bits)));

Logger.Log(string.Format(string.Format("Resize to {0} bits done", bits)));

Even though Logger.Log per default sends any string into void, this still results in some unnecessary string allocations.

Solution

I would suggest deleting those lines or hide them behind #if DEBUG

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions