path: improve posixSplitPath performance
authorEvan Lucas <evanlucas@me.com>
Wed, 23 Sep 2015 21:29:01 +0000 (16:29 -0500)
committerRod Vagg <rod@vagg.org>
Wed, 30 Sep 2015 06:02:13 +0000 (16:02 +1000)
commitac2bce0b0c91ba9fc593d8c53c68b42d3c1e4954
tree1e6e6de0dbfe92e75114bd98eb39a19d9f876efc
parent9a593abc47a07bf53108e2cb90161d9665434c70
path: improve posixSplitPath performance

Instead of slicing the first element off of the matches, shift and then
return. This improves performance of the following path functions:

- basename: 18-20%
- extname: 60-70%
- dirname: 18-20%
- parse: 20-25%

PR-URL: https://github.com/nodejs/node/pull/3034
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
lib/path.js