Skip to content

Conversation

@lahma
Copy link
Collaborator

@lahma lahma commented Nov 25, 2024

When checked target is IEnumerable, it's highly likely to implement ICollection. ICollection.Count is basically free and doesn't require enumerator building and boxing.

Testing with https://github.com/martincostello/aspnetcore-openapi/tree/main/perf/TodoApp.Benchmarks configured to run against local sources.

master

3,273,252.20 ns

this PR:

3,064,969.34 ns

@lahma lahma merged commit c740804 into RicoSuter:master Nov 25, 2024
2 checks passed
@lahma lahma deleted the IgnoreEmptyCollectionsContractResolver-collection-check branch November 25, 2024 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant