Skip to content

Commit 65aeaf7

Browse files
committed
explain why const is better then function
1 parent c87aa82 commit 65aeaf7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/vs/base/common/paths.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ export function getRoot(path: string, sep: string = '/'): string {
229229
}
230230

231231
export const join: (...parts: string[]) => string = function () {
232+
// Not using a function with var-args because of how TS compiles
233+
// them to JS - it would result in 2*n runtime cost instead
234+
// of 1*n, where n is parts.length.
232235

233236
let value = '';
234237
for (let i = 0; i < arguments.length; i++) {

0 commit comments

Comments
 (0)