Conversation
| item = items[i]; | ||
| width = item.width; | ||
| color = item.color; | ||
| const item = items[i]; |
There was a problem hiding this comment.
The V8 (or even babel) probably fixes this, but essentially we are instructing to allocate new variable for each iteration (that will be garbage collected later). So i think it would be good practice to allocate outside loop and reuse.
Correct me if I'm wrong :)
There was a problem hiding this comment.
I wouldn't think we'd be able to notice any impact here. Maybe if it were something we were doing for every data point, but there won't be many grid lines
There was a problem hiding this comment.
I agree that this is not a critical part. The amount of garbage generated is quite large and we should try to minimize that. Lets just keep that in mind :)
There was a problem hiding this comment.
Yeah, could be worth testing for some of the loops that go over all data points
Made one variable private and removed another. Changed everything to use
constandlet