Re: Performance concern with let/const

2012-09-18 Thread Andreas Rossberg
On 17 September 2012 18:37, Luke Hoban lu...@microsoft.com wrote: 'let' is certainly not going to be faster than 'var' in any case There is at least one very important counterexample to that claim: the global scope. Assuming lexical global scope (as we tentatively agreed upon at the last

Re: Performance concern with let/const

2012-09-18 Thread Allen Wirfs-Brock
On Sep 18, 2012, at 7:27 AM, Andreas Rossberg wrote: On 17 September 2012 19:51, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Sep 17, 2012, at 12:37 PM, Luke Hoban wrote: These are good questions. Paul will be attending the TC39 meeting this week, and can likely talk to specific

Re: Performance concern with let/const

2012-09-18 Thread Andreas Rossberg
On 18 September 2012 13:41, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Yes but but there are fairly simple heuristics that approximate that result, for example: if no function calls dominate the initialization of x then TDZ checks will never need to be made for x Yes, except that in

Re: Performance concern with let/const

2012-09-17 Thread Allen Wirfs-Brock
some comments below On Sep 16, 2012, at 9:35 PM, Luke Hoban wrote: We've begun deeper investigations of implementation practicalities related to let/const, and two significant performance concerns have been raised. I think these both merit re-opening discussion of two aspects of the

RE: Performance concern with let/const

2012-09-17 Thread Luke Hoban
From: Andreas Rossberg [mailto:rossb...@google.com] On 17 September 2012 03:35, Luke Hoban lu...@microsoft.com wrote: __Temporal dead zones__ As an experiment, I took the early-boyer test from V8 and changed 'var' to 'let'. In Chrome preview builds with 'let' support, I saw a

Re: Performance concern with let/const

2012-09-17 Thread François REMY
(Just one opinion) I'm all in favor of function-level parse errors. This reminds me an article of Ian Hickson where he wondered why, to the contrary of CSS, the ECMAScript language didn't define a generic syntax defining a well-formed program (tokens, parenthesis+brackets balance, ...) and

Re: Performance concern with let/const

2012-09-17 Thread Brendan Eich
Agree with your points in reply to Luke, one clarification here: Allen Wirfs-Brock wrote: As stated above, let isn't the motivator for TDZ, it's const. Let could easily be redefined to not need a TDZ (if that really proved to be a major area of concern). So, you either need to argument

RE: Performance concern with let/const

2012-09-17 Thread Luke Hoban
From: Allen Wirfs-Brock [mailto:al...@wirfs-brock.com] On Sep 16, 2012, at 9:35 PM, Luke Hoban wrote: As an experiment, I took the early-boyer test from V8 and changed 'var' to 'let'. In Chrome preview builds with 'let' support, I saw a consistent ~27% slowdown. That is, the 'let is the

RE: Performance concern with let/const

2012-09-17 Thread Luke Hoban
From: Brendan Eich [mailto:bren...@mozilla.org] Allen Wirfs-Brock wrote: As stated above, let isn't the motivator for TDZ, it's const. Let could easily be redefined to not need a TDZ (if that really proved to be a major area of concern). So, you either need to argument against const

Re: Performance concern with let/const

2012-09-17 Thread Allen Wirfs-Brock
On Sep 17, 2012, at 12:37 PM, Luke Hoban wrote: These are good questions. Paul will be attending the TC39 meeting this week, and can likely talk to specific details. High level though, we statically eliminate the TDZ checks for references to 'let' within the same closure body as the

Re: Performance concern with let/const

2012-09-17 Thread Domenic Denicola
2. The stated goal of 'let' is to replace 'var' in common usage (and if this is not the goal, we should not be adding 'let'). There is actually some disagreement about that statement of the goal. The goal of let is to provide variable that are scoped to the block level. That is the