Optimise path finding to remove the last exists test#45
Merged
marchermans merged 2 commits intoMcModLauncher:mainfrom Nov 9, 2023
Merged
Optimise path finding to remove the last exists test#45marchermans merged 2 commits intoMcModLauncher:mainfrom
marchermans merged 2 commits intoMcModLauncher:mainfrom
Conversation
Member
Author
|
As a tangent, the |
Technici4n
reviewed
Nov 6, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UnionFileSystem#findFirstFilteredwill currently check if a file exists for every merged path. This is a bit inefficient since this causes possibly unneeded existence checks, that can in some cases be heavy (for example, native checks on Windows for files on the C drive).This PR makes
findFirstFilterednot check for the existence of the last path, and simply return it if all previous paths did not exist. As in all cases where the method is used, if the optional is empty aNoSuchFileExceptionwill be raised (intentionally), this is a safe change to make.Benchmark; the declines can be safely considered error margin.