3 ms·
When can we have const back? At some point esbuild started to transpile all const/let/var statements to var, which can potentially cause a slight performance de
by Sephr 6y ago
When can we have const back? At some point esbuild started to transpile all const/let/var statements to var, which can potentially cause a slight performance decrease in some hot code paths (or at least a slight memory usage increase as noted in https://stackoverflow.com/a/52749016/78436 https://stackoverflow.com/a/52749016/78436).
- windowojji 6y agoCan you elaborate on this? const and let should be interchangeable from a performance perspective because it's not like the engine needs your input to know whether a binding is reassigned ever (that's a fundamentally easy thing for a compiler to check) so I must conclude that you're seeing performance benefits from using block scoped variables with TDZ that disappear when you use function scoped variables with var?
- deleted 6y ago[deleted]