Skip to content

Commit 8b4fd37

Browse files
committed
adding simple commented perf tests for new paths impl
1 parent fd79885 commit 8b4fd37

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

src/vs/base/test/common/paths.node.test.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,4 +730,66 @@ suite('Paths (Node Implementation)', () => {
730730
assert.strictEqual(path, path.posix);
731731
}
732732
});
733+
734+
// test('perf', () => {
735+
// const folderNames = [
736+
// 'abc',
737+
// 'Users',
738+
// 'reallylongfoldername',
739+
// 's',
740+
// 'reallyreallyreallylongfoldername',
741+
// 'home'
742+
// ];
743+
744+
// const basePaths = [
745+
// 'C:',
746+
// '',
747+
// ];
748+
749+
// const separators = [
750+
// '\\',
751+
// '/'
752+
// ];
753+
754+
// function randomInt(ciel: number): number {
755+
// return Math.floor(Math.random() * ciel);
756+
// }
757+
758+
// let pathsToNormalize = [];
759+
// let pathsToJoin = [];
760+
// let i;
761+
// for (i = 0; i < 1000000; i++) {
762+
// const basePath = basePaths[randomInt(basePaths.length)];
763+
// let lengthOfPath = randomInt(10) + 2;
764+
765+
// let pathToNormalize = basePath + separators[randomInt(separators.length)];
766+
// while (lengthOfPath-- > 0) {
767+
// pathToNormalize = pathToNormalize + folderNames[randomInt(folderNames.length)] + separators[randomInt(separators.length)];
768+
// }
769+
770+
// pathsToNormalize.push(pathToNormalize);
771+
772+
// let pathToJoin = '';
773+
// lengthOfPath = randomInt(10) + 2;
774+
// while (lengthOfPath-- > 0) {
775+
// pathToJoin = pathToJoin + folderNames[randomInt(folderNames.length)] + separators[randomInt(separators.length)];
776+
// }
777+
778+
// pathsToJoin.push(pathToJoin + '.ts');
779+
// }
780+
781+
// let newTime = 0;
782+
783+
// let j;
784+
// for(j = 0; j < pathsToJoin.length; j++) {
785+
// const path1 = pathsToNormalize[j];
786+
// const path2 = pathsToNormalize[j];
787+
788+
// const newStart = performance.now();
789+
// path.join(path1, path2);
790+
// newTime += performance.now() - newStart;
791+
// }
792+
793+
// assert.ok(false, `Time: ${newTime}ms.`);
794+
// });
733795
});

0 commit comments

Comments
 (0)