复合 let/const 赋值是什么意思?

What does compound let/const assignment mean?

Bluebird 图书馆的 wiki 中有一篇文章 Optimization killers。这篇文章中有一句话:

Currently not optimizable:
...
Functions that contain a compound let assignment
Functions that contain a compound const assignment

复合 let 赋值和复合 const 赋值是什么意思? 在 ECMAScript 5.1 中有 compound assignment 的概念,但在 ECMAScript 2015 中,似乎没有任何复合赋值的概念,只有常规赋值。

我怀疑复合let和const赋值,它只是声明后的复合赋值。例如:

let n = 1;
n += 4;

我说得对吗?

是的,这似乎正是它的意思。我有以下代码(删除了不相关的附加行):

function updatePlayer(player) {
    let direction = player.getDirection();
    if (player.isPressingLeft()) {
        direction += angleChange;
    }
    if (player.isPressingRight()) {
        direction -= angleChange;
    }
    player.setDirection(direction);
}

updatePlayer 生成警告,未优化:Chrome 的 配置文件[=26= 中不支持复合赋值 ] 选项卡,所以我尝试 l = l + r 而不是 l += r 并获得了显着、一致的性能改进。

jsPerf shows that let compound assignments are indeed extremely slow in Chrome 49.0.2623,与l = l + rvar相比!我想这会在未来的版本中得到修复,因为 Firefox、IE11 和 Edge 都不受影响,而且 Google 显然知道这个问题。