GetContainingFolder

JavaScript performance comparison

Test case created by Nick Tulett

Info

Compare regex to split.slice.join for parsing containing folder of a full file path

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
split.slice.join
"C:\\Program Files\\foo\\bar\\foobar.txt".split('\\').slice(0,-1).join('\\');
pending…
regex
"C:\\Program Files\\foo\\bar\\foobar.txt".match(/(.*\\)[^\\]*$/)[1];
pending…
replace
"C:\\Program Files\\foo\\bar\\foobar.txt".replace(/[^\\]*$/, '');
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment