unity-jar-resolver
unity-jar-resolver copied to clipboard
Improve performance of XmlDependencies IsDependenciesFile
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:
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
- [x] Implement and unit-test my change
- [x] Test the change in a production project
- [x] Update the changelog in the repo root
- [x] Update the version in the build.gradle
- [ ] Wait for PR feedback
- [ ] Build the release using
./gradlew release - [ ] Create release commit using
./gradlew gitCreateReleaseCommit - [ ] Tag the release using
./gradlew gitTagReleaseandgit push --tag REMOTE HEAD:master