Re:Some features that every JavaScript developer should know...
by senfiaj on Tuesday April 15, 2025 @10:07AM
(#43692898)
> My own hypothesis: any serious JS engine is going to recognise the [a, b] = [b, a]
This. As the author of this blog I actually run a benchmark, the loop body was only doing swap, I remember the penalty was around ~2%. But yeah, if it's a critical path and you care about every millisecond, then sure, you should optimize for speed, not for code ergonomics.
This. As the author of this blog I actually run a benchmark, the loop body was only doing swap, I remember the penalty was around ~2%. But yeah, if it's a critical path and you care about every millisecond, then sure, you should optimize for speed, not for code ergonomics.