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

Preallocate dictionary size in ToDictionaryWithConflictLog #19907

Merged
merged 1 commit into from Feb 2, 2022

Conversation

RoosterDragon
Copy link
Member

This saves some allocations in MiniYaml parsing on startup, but with also benefit other callers of the method.

@RoosterDragon
Copy link
Member Author

I suspect the build failure will be solved by #19902

@abcdefg30
Copy link
Member

I suspect the build failure will be solved by #19902

Only the build compiling with Mono is failing:

Exts.cs(410,11): error CS1061: 'IEnumerable' does not contain a definition for 'TryGetNonEnumeratedCount' and no accessible extension method 'TryGetNonEnumeratedCount' accepting a first argument of type 'IEnumerable' could be found (are you missing a using directive or an assembly reference?) [/home/runner/work/OpenRA/OpenRA/OpenRA.Game/OpenRA.Game.csproj]

Does Mono not contain this method?

@teinarss
Copy link
Contributor

teinarss commented Jan 30, 2022 via email

@abcdefg30
Copy link
Member

Then we might need to add a Mono only path that uses the old code.

@RoosterDragon
Copy link
Member Author

Switched to a cast on ICollection<T> which suffices for our purposes.

@penev92
Copy link
Member

penev92 commented Jan 30, 2022

Makes sense 👍

OpenRA.Game/Exts.cs Outdated Show resolved Hide resolved
@abcdefg30 abcdefg30 merged commit 1bc95a2 into OpenRA:bleed Feb 2, 2022
@abcdefg30
Copy link
Member

Changelog

@RoosterDragon RoosterDragon deleted the conflict-dict-alloc branch February 3, 2022 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants