Removes regex from extended length path check #26
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.
The existing method uses regex to check if the first four characters indicate that the path is an extended-length path. This is not as performant as using
startsWith
which checks the first four characters without using a regex.Using the
benchmark
package, I compared the performance by evaluating the following strings:The resulting data backed up the idea for performance improvement:
NORMAL_STRING_WITH_REPLACE
original x 4,243,922 ops/sec ±0.95% (88 runs sampled)
new x 4,591,650 ops/sec ±0.78% (91 runs sampled)
~8.1% increase in ops/sec
EXTENDED_PATH
original x 26,703,612 ops/sec ±1.16% (93 runs sampled)
new x 43,472,723 ops/sec ±3.22% (87 runs sampled)
~62% increase in ops/sec
NORMAL_STRING_NO_REPLACE
original x 10,698,194 ops/sec ±0.82% (92 runs sampled)
new x 12,566,525 ops/sec ±0.80% (94 runs sampled)
~17% increase in ops/sec
Note that these benchmarks were run on my local notebook though repeated multiple times with similar results.