• Robert Griesemer's avatar
    cmd/compile/internal/syntax: add position info for { and } braces · e0329248
    Robert Griesemer authored
    This change adds position information for { and } braces in the
    source. There's a 1.9% increase in memory use for syntax.Nodes,
    which is negligible relative to overall compiler memory consumption.
    
    Parsing the std library (using syntax package only) and memory
    consumption before this change (fastest of 5 runs):
    
      $ go test -run StdLib -fast
      parsed 1516827 lines (3392 files) in 780.612335ms (1943124 lines/s)
      allocated 379.903Mb (486.673Mb/s)
    
    After this change (fastest of 5 runs):
    
      $ go test -run StdLib -fast
      parsed 1517022 lines (3394 files) in 793.487886ms (1911840 lines/s)
      allocated 387.086Mb (267B/line, 487.828Mb/s)
    
    While not an exact apples-to-apples comparison (the syntax package
    has changed and is also parsed), the overall impact is small.
    
    Also: Small improvements to nodes_test.go.
    
    Change-Id: Ib8a7f90bbe79de33d83684e33b1bf8dbc32e644a
    Reviewed-on: https://go-review.googlesource.com/38435Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
    e0329248
nodes_test.go 8.66 KB