hello, I've seen a performance difference depending on whether or not a variable is used in the loop.
let longString = ''; for (let i=0;i<10000000;i++) { longString += `${i}`; } console.log(longString.length); let cnt = 0; const st = Date.now(); for (let i=0;i<longString.length - 1;i++) { if (longString[1] === longString[0]) { /// if (longString[i] === longString[0]) { cnt ++; } } console.log(Date.now() - st, cnt); It is twice as slow with longString[i] than with longString[1]. What optimizations are causing these results? It doesn't seem to have anything to do with ConsString flattening. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/1ad8718f-5f83-44de-b3de-287625646eb8n%40googlegroups.com.