Conversation
|
A benchmark shows for-of loop is much slower on Chrome (and thus node.js), does this mean we shouldn't use for-of? |
|
|
|
Already done the upgrade for obvious cases but many of them are using indices so I couldn't do it for them. |
mhegazy
left a comment
There was a problem hiding this comment.
I would inline the collection.length check instead of adding a new variable for it. There is not much perf difference on modern engines anyways.
| const result: Signature[] = []; | ||
| for (let i = 0, len = symbol.declarations.length; i < len; i++) { | ||
| const len = symbol.declarations.length; | ||
| for (let i = 0; i < len; i++) { |
There was a problem hiding this comment.
Inner lines of code use i for some purpose. It seems I can still switch to for-of in this case but should I do it?
| for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { | ||
| const n = declaration.parameters.length; | ||
| for (let i = isJSConstructSignature ? 1 : 0; i < n; i++) { | ||
| const param = declaration.parameters[i]; |
There was a problem hiding this comment.
for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) {
|
@saschanaz i have merged a change to move tslint back to |
|
It still won't pass because of some bugs, which should be fixed on tslint side. |
do you have a list of the issues? |
|
@mhegazy See first post and palantir/tslint#1898. I actually fixed one of them yesterday. The other one is also a legitimate issue, but could be fixed on our end by moving the declaration ( |
|
@Andy-MS I'm still seeing destructuring issue on Travis, should I do something to get the merged fix? |
|
|
|
I'd prefer not to change our code to workaround bugs in the toolchain hence palantir/tslint#1908 |
|
@nchen63 any news about palantir/tslint#1908? |
|
it's merged and included in a new release, v4.2.0 |
|
It seems |
|
should be fixed now |
Except this type of errors:
I think they are tslint bugs rather than actual code problem. (palantir/tslint#1898)
BTW I feel fairly painful to create a new constant for every for-loop, I hope there is a better way to keep high performance...