googlesamples / unity-jar-resolver

Unity plugin which resolves Android & iOS dependencies and performs version management
Other
1.21k stars 337 forks source link

Improve performance of XmlDependencies IsDependenciesFile #602

Open chrisyarbrough opened 1 year ago

chrisyarbrough commented 1 year ago

Why this change?

This implements the improvement for issue: https://github.com/googlesamples/unity-jar-resolver/issues/601

The XmlDependencies.IsDependenciesFile method is called thousands of times in large projects and is now much faster than before:

IsDependenciesFile_Before IsDependenciesFile _After

The previous slowdown was causing long waiting times during content iteration in Unity projects with more than a few hundred assets.

What did I do?

I added a new test project to add a test which fixates the previous logic of file pattern matches with regex. I then replaced the regex with simpler string manipulation.

To avoid breaking API changes, I kept the public method in PlayServicesResolver the same, but internally, the new code uses a delegate which accepts a file path and returns true if it's a match. This way we can have both the Regex expressions passed from existing user code and a faster version for the internal default which only searches for the Dependencies.xml files in editor folders.

Review & Release

The review should be easiest commit-by-commit.

Feedback is greatly appreciated and please let me know which steps I need to take to make my change release-ready or if any of the maintainers will take over. Thank you! :)

Tasks

Tommigun1980 commented 1 year ago

@chkuang-g Hi. What's the status of this? When will it be released?

Tommigun1980 commented 1 year ago

Hi @chkuang-g, when do you estimate this fix to land? Thanks.

Tommigun1980 commented 11 months ago

@chkuang-g Hi, when will this PR land?

chrisyarbrough commented 4 months ago

I finally got some time to apply the review feedback. I retested the changes in my large company project and the custom changes still show some good improvements in Unity.