There is an article Optimization killers in wiki of Bluebird library. In this article there is a phrase:
Currently not optimizable:
...
Functions that contain a pound let assignment
Functions that contain a pound const assignment
What does pound let assignment and pound const assignment mean? In ECMAScript 5.1 there was notion of pound assignment but in ECMAScript 2015, it seems there is no notion of any pound assignment there is only regular assignments.
I suspect that pound let and const assignment, it is just pound assignment after declaration. For example:
let n = 1;
n += 4;
Am I right?
There is an article Optimization killers in wiki of Bluebird library. In this article there is a phrase:
Currently not optimizable:
...
Functions that contain a pound let assignment
Functions that contain a pound const assignment
What does pound let assignment and pound const assignment mean? In ECMAScript 5.1 there was notion of pound assignment but in ECMAScript 2015, it seems there is no notion of any pound assignment there is only regular assignments.
I suspect that pound let and const assignment, it is just pound assignment after declaration. For example:
let n = 1;
n += 4;
Am I right?
Share Improve this question asked Jan 4, 2016 at 16:19 Alexander MyshovAlexander Myshov 3,1013 gold badges23 silver badges32 bronze badges 1-
From the definition of pound: "a thing that is posed of two or more separate elements; a mixture." From that, I would think that
let n = 1 + someval
is a pound assignment andlet n = 1
is not? Couldn't say with absolute confidence though... – An0nC0d3r Commented Jan 4, 2016 at 16:35
1 Answer
Reset to default 15Yes, that seems to be exactly what it means. I had the following code (irrelevant additional lines removed):
function updatePlayer(player) {
let direction = player.getDirection();
if (player.isPressingLeft()) {
direction += angleChange;
}
if (player.isPressingRight()) {
direction -= angleChange;
}
player.setDirection(direction);
}
updatePlayer
generated a warning, Not optimized: Unsupported let pound assignment, in Chrome's Profiles tab, so instead of l += r
I tried l = l + r
and got a significant, consistent performance improvement.
jsPerf shows that let
pound assignments are indeed extremely slow in Chrome 49.0.2623, pared to l = l + r
or var
! I guess this will be fixed in a future version, since neither Firefox nor IE11 nor Edge is affected, and since Google apparently know about the issue.