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

[Xamarin.Android.Build.Tasks] _CreateAapt2VersionCache slow due to wildcard usage #2124

Merged
merged 4 commits into from
Sep 5, 2018

Conversation

dellis1972
Copy link
Contributor

Fixes #2121

There were a number of performace issues with _CreateAapt2VersionCache.
First the wildcards were processing the ENTIRE $(IntermediateOutputPath)!
What they should have been doing was targeting specific
directories. I.e the root of $(IntermediateOutputPath) and
the directories under $(IntermediateOutputPath)\lp.

Second the target did not have a Condition to stop it running if
the versions matched, so that has been added.

However, even if a target is NOT run. MSbuild will still evaluate
the PropertyGroups and ItemGroups within the targets. So we
need to add Conditon on the _CompiledFlataArchive and
_CompiledFlataStamp items as well.

With these in place the time when this target is skipped is down
to 1ms.

<_CompiledFlataStamp Include="$(IntermediateOutputPath)\**\compiled.stamp"/>
<_CompiledFlataArchive Include="$(IntermediateOutputPath)\lp\**\*.flata" Condition="'$(_Aapt2Version)' != '@(_Aapt2VersionCache)'" />
<_CompiledFlataArchive Include="$(IntermediateOutputPath)\*.flata" Condition="'$(_Aapt2Version)' != '@(_Aapt2VersionCache)'" />
<_CompiledFlataStamp Include="$(IntermediateOutputPath)\lp\**\compiled.stamp" Condition="'$(_Aapt2Version)' != '@(_Aapt2VersionCache)'" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe all of these should use $(_AndroidLibrayProjectIntermediatePath)? (aaah typo)

Then these would still work if someone has $(UseShortFileNames)=False.

…wildcard usage

Fixes dotnet#2121

There were a number of performace issues with `_CreateAapt2VersionCache`.
First the wildcards were processing the ENTIRE `$(IntermediateOutputPath)`!
What they should have been doing was targeting specific
directories. I.e the root of `$(IntermediateOutputPath)` and
the directories under `$(IntermediateOutputPath)\lp`.

The target did not have a Condition to stop it running if
the versions matched, so that has been added.

However, even if a target is NOT run. MSbuild will still evaluate
the `PropertyGroups` and `ItemGroups` within the targets. So we
need to add `Conditon` on the `_CompiledFlataArchive` and
`_CompiledFlataStamp` items as well.

With these in place the time when this target is skipped is down
to 1ms.
@dellis1972
Copy link
Contributor Author

@jonpryor this should be good ,the failing test is

ConditionalWeakTableTest.Xamarin.Android.Bcl_Tests, MonoTests.System.Runtime.CompilerServices.ConditionalWeakTableTest.InsertStress / Debug

which is not related to this PR.

@jonpryor jonpryor merged commit 35ad986 into dotnet:master Sep 5, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants