Last 12 weeks · 0 commits
4 of 6 standards met
Resend #27. This is have some changes: Avoid regex & use string method to improve performance. Early return if it's a \*NIX path (don't have Windows forward slash). Tested on Android (3GB RAM). All fixture paths are AI-generated. I hope you're okay with this :). Windows Paths UNIX Paths Mixed Paths UNC Paths (don't care about this)
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 which checks the first four characters without using a regex. Using the 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.
Repository: sindresorhus/slash. Description: Convert Windows backslash paths to slash paths Stars: 337, Forks: 57. Primary language: JavaScript. Languages: JavaScript (84.8%), TypeScript (15.2%). License: MIT. Latest release: v5.1.0 (3y ago). Open PRs: 0, open issues: 0. Last activity: 3y ago. Community health: 85%. Top contributors: sindresorhus, dario-piotrowicz, BendingBender, birjj, kevva, paulmillr, Richienb, emagers.