Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Issue 8400017: Peek past balanced parens to see if they are an expression or lambda. (Closed)

Created:
9 years, 1 month ago by sra1
Modified:
9 years ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Peek past balanced parens to see if they are function parameters (followed by '{' or '=>') or an expression. The VM uses the same look-ahead technique. This avoids the need to parse a formal parameters list first as an expression list and then convert it into formal parameters by re-parsing the expression fragments. A map is maintained to avoid rescanning the tokens. The map is from position of open paren to token following close paren. There is no practical measurable performance difference but there are some measurable differences on pathological inputs that contain insane numbers of parens. The map prevents these pathological inputs from having a performance effect other than a small constant factor. The worst is insanely deep parens. (((x))) parens 2000 deep old: 260ms, new: 640ms - mostly hash table access. (((x+x)+(x+x))+((x+x)+(x+x))) old: 2.24, new: 2.40 - 16k expression. f()()()... 900 calls deep, old: 480ms, new: 390ms f = ()=>()=>()=> ... =>1; old: 870ms, new: 840ms - 100 functions deep. frogsh: old: 1.370 new: 1.380 BUG= TEST=

Patch Set 1 #

Patch Set 2 : merge #

Patch Set 3 : frogsh #

Patch Set 4 : frogsh #

Patch Set 5 : Cleanup #

Patch Set 6 : Comments #

Patch Set 7 : merge #

Patch Set 8 : un-suppress the test this fixes #

Patch Set 9 : expand comments #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+221 lines, -241 lines) Patch
M frogsh View 1 2 3 4 5 6 15 chunks +99 lines, -118 lines 0 comments Download
M parser.dart View 1 2 3 4 5 6 7 8 10 chunks +114 lines, -121 lines 4 comments Download
M tests/frog/frog.status View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M tokenizer.dart View 1 2 chunks +8 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
sra1
I think we should parse formal lists this way. - avoids the need for crazy ...
9 years, 1 month ago (2011-10-31 05:30:17 UTC) #1
jimhug
This looks really good to me. I'm pretty sold by the fact that it is ...
9 years, 1 month ago (2011-10-31 14:16:46 UTC) #2
jimhug
9 years, 1 month ago (2011-11-22 18:22:06 UTC) #3
lgtm

Powered by Google App Engine
This is Rietveld 408576698