1. 13 Aug, 2013 8 commits
    • Russ Cox's avatar
      cmd/gc: add temporary-merging optimization pass · fa72679f
      Russ Cox authored
      The compilers assume they can generate temporary variables
      as needed to preserve the right semantics or simplify code
      generation and the back end will still generate good code.
      This turns out not to be true. The back ends will only
      track the first 128 variables per function and give up
      on the remainder. That needs to be fixed too, in a later CL.
      
      This CL merges temporary variables with equal types and
      non-overlapping lifetimes using the greedy algorithm in
      Poletto and Sarkar, "Linear Scan Register Allocation",
      ACM TOPLAS 1999.
      
      The result can be striking in the right functions.
      
      Top 20 frame size changes in a 6g godoc binary by bytes saved:
      
      5464 1984 (-3480, -63.7%) go/build.(*Context).Import
      4456 1824 (-2632, -59.1%) go/printer.(*printer).expr1
      2560   80 (-2480, -96.9%) time.nextStdChunk
      3496 1608 (-1888, -54.0%) go/printer.(*printer).stmt
      1896  272 (-1624, -85.7%) net/http.init
      2688 1400 (-1288, -47.9%) fmt.(*pp).printReflectValue
      2800 1512 (-1288, -46.0%) main.main
      3296 2016 (-1280, -38.8%) crypto/tls.(*Conn).clientHandshake
      1664  488 (-1176, -70.7%) time.loadZoneZip
      1760  608 (-1152, -65.5%) time.parse
      4104 3072 (-1032, -25.1%) runtime/pprof.writeHeap
      1680  712 ( -968, -57.6%) go/ast.Walk
      2488 1560 ( -928, -37.3%) crypto/x509.parseCertificate
      1128  392 ( -736, -65.2%) math/big.nat.divLarge
      1528  864 ( -664, -43.5%) go/printer.(*printer).fieldList
      1360  712 ( -648, -47.6%) regexp/syntax.(*parser).factor
      2104 1528 ( -576, -27.4%) encoding/asn1.parseField
      1064  504 ( -560, -52.6%) encoding/xml.(*Decoder).text
       584   48 ( -536, -91.8%) html.init
      1400  864 ( -536, -38.3%) go/doc.playExample
      
      In the same godoc build, cuts the number of functions with
      too many vars from 83 to 32.
      
      R=ken2
      CC=golang-dev
      https://golang.org/cl/12829043
      fa72679f
    • Rob Pike's avatar
      doc/go1.2.txt: bufio.{Writer,Reader}.Reset · 306c29e9
      Rob Pike authored
      R=golang-dev, bradfitz
      CC=golang-dev
      https://golang.org/cl/12830043
      306c29e9
    • Brad Fitzpatrick's avatar
      cmd/api: don't fail API check if there's no network · 4d249433
      Brad Fitzpatrick authored
      If the hg checkout of go.tools fails, check for Internet
      connectivity before failing.
      
      R=golang-dev, shivakumar.gn
      CC=golang-dev
      https://golang.org/cl/12814043
      4d249433
    • Russ Cox's avatar
      4984e6e9
    • Russ Cox's avatar
      cmd/gc: move flow graph into portable opt · dbf96add
      Russ Cox authored
      Now there's only one copy of the flow graph construction
      and dominator computation, and different optimizations
      can attach different annotations to the instructions.
      
      R=ken2
      CC=golang-dev
      https://golang.org/cl/12797045
      dbf96add
    • Rob Pike's avatar
      go/build: change the wording of NoGoError and comment it better · 954d1474
      Rob Pike authored
      Out of context, it can be very confusing because there can be lots of Go
      files in the directory, but the error message says there aren't.
      
      R=golang-dev, dsymonds, rsc
      CC=golang-dev
      https://golang.org/cl/12823043
      954d1474
    • Elias Naur's avatar
      text/template: Make function call builtin handle nil errors correctly · 83348a13
      Elias Naur authored
      The call builtin unconditionally tries to convert a second return value from a function to the error type. This fails in case nil is returned, effectively making call useless for functions returning two values.
      
      This CL adds a nil check for the second return value, and adds a test.
      
      Note that for regular function and method calls the nil error case is handled correctly and is verified by a test.
      
      R=r
      CC=golang-dev
      https://golang.org/cl/12804043
      83348a13
    • Russ Cox's avatar
      cmd/6g, cmd/8g: proginfo carry fixes · 9a0a59f1
      Russ Cox authored
      Bugs pointed out by cshapiro in CL 12637051.
      
      R=cshapiro
      CC=golang-dev
      https://golang.org/cl/12815043
      9a0a59f1
  2. 12 Aug, 2013 18 commits
  3. 11 Aug, 2013 3 commits
    • Dmitriy Vyukov's avatar
      runtime/pprof: add block profile test · 2758101b
      Dmitriy Vyukov authored
      Fixes #5993.
      
      R=golang-dev, bradfitz
      CC=golang-dev
      https://golang.org/cl/12665046
      2758101b
    • Brad Fitzpatrick's avatar
      net/http: simplify server, use bufio Reader.Reset and Writer.Reset · 3e38b7f2
      Brad Fitzpatrick authored
      Update #5100
      Update #6086
      
      Remove switchReader, switchWriter, switchReaderPair,
      switchWriterPair, etc.
      
      Now it only maintains pools of bufio Readers and Writers, but
      uses Reset instead of working around all their
      previously-associated state.
      
      Compared to before the bufio Reset change, it's the same number of
      allocations, and also faster:
      
      benchmark                                   old ns/op    new ns/op    delta
      BenchmarkClientServer                          111218       109828   -1.25%
      BenchmarkClientServerParallel4                  70580        70013   -0.80%
      BenchmarkClientServerParallel64                 72636        68919   -5.12%
      BenchmarkServer                                139858       137068   -1.99%
      BenchmarkServerFakeConnNoKeepAlive              14619        14314   -2.09%
      BenchmarkServerFakeConnWithKeepAlive            12390        11361   -8.31%
      BenchmarkServerFakeConnWithKeepAliveLite         7630         7306   -4.25%
      BenchmarkServerHandlerTypeLen                    9688         9342   -3.57%
      BenchmarkServerHandlerNoLen                      8700         8470   -2.64%
      BenchmarkServerHandlerNoType                     9255         8949   -3.31%
      BenchmarkServerHandlerNoHeader                   7058         6806   -3.57%
      
      benchmark                                  old allocs   new allocs    delta
      BenchmarkClientServer                              61           61    0.00%
      BenchmarkClientServerParallel4                     61           61    0.00%
      BenchmarkClientServerParallel64                    61           61    0.00%
      BenchmarkServer                                    16           16    0.00%
      BenchmarkServerFakeConnNoKeepAlive                 24           24    0.00%
      BenchmarkServerFakeConnWithKeepAlive               19           19    0.00%
      BenchmarkServerFakeConnWithKeepAliveLite            9            9    0.00%
      BenchmarkServerHandlerTypeLen                      17           17    0.00%
      BenchmarkServerHandlerNoLen                        14           14    0.00%
      BenchmarkServerHandlerNoType                       15           15    0.00%
      BenchmarkServerHandlerNoHeader                      9            9    0.00%
      
      benchmark                                   old bytes    new bytes    delta
      BenchmarkClientServer                            6988         6985   -0.04%
      BenchmarkClientServerParallel4                   6979         6985    0.09%
      BenchmarkClientServerParallel64                  7002         7019    0.24%
      BenchmarkServer                                  1846         1848    0.11%
      BenchmarkServerFakeConnNoKeepAlive               2420         2412   -0.33%
      BenchmarkServerFakeConnWithKeepAlive             2126         2129    0.14%
      BenchmarkServerFakeConnWithKeepAliveLite          989          990    0.10%
      BenchmarkServerHandlerTypeLen                    1818         1819    0.06%
      BenchmarkServerHandlerNoLen                      1775         1777    0.11%
      BenchmarkServerHandlerNoType                     1783         1785    0.11%
      BenchmarkServerHandlerNoHeader                    989          990    0.10%
      
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/12708046
      3e38b7f2
    • Brad Fitzpatrick's avatar
      bufio: drop buffer recycling, add Reader.Reset and Writer.Reset · ede9aa9e
      Brad Fitzpatrick authored
      Fixes #6086
      
      R=golang-dev, pieter, r, rsc
      CC=golang-dev
      https://golang.org/cl/12603049
      ede9aa9e
  4. 10 Aug, 2013 4 commits
    • Russ Cox's avatar
      cmd/gc: zero pointers on entry to function · 7910cd68
      Russ Cox authored
      On entry to a function, zero the results and zero the pointer
      section of the local variables.
      
      This is an intermediate step on the way to precise collection
      of Go frames.
      
      This can incur a significant (up to 30%) slowdown, but it also ensures
      that the garbage collector never looks at a word in a Go frame
      and sees a stale pointer value that could cause a space leak.
      (C frames and assembly frames are still possibly problematic.)
      
      This CL is required to start making collection of interface values
      as precise as collection of pointer values are today.
      Since we have to dereference the interface type to understand
      whether the value is a pointer, it is critical that the type field be
      initialized.
      
      A future CL by Carl will make the garbage collection pointer
      bitmaps context-sensitive. At that point it will be possible to
      remove most of the zeroing. The only values that will still need
      zeroing are values whose addresses escape the block scoping
      of the function but do not escape to the heap.
      
      benchmark                         old ns/op    new ns/op    delta
      BenchmarkBinaryTree17            4420289180   4331060459   -2.02%
      BenchmarkFannkuch11              3442469663   3277706251   -4.79%
      BenchmarkFmtFprintfEmpty                100          142  +42.00%
      BenchmarkFmtFprintfString               262          310  +18.32%
      BenchmarkFmtFprintfInt                  213          281  +31.92%
      BenchmarkFmtFprintfIntInt               355          431  +21.41%
      BenchmarkFmtFprintfPrefixedInt          321          383  +19.31%
      BenchmarkFmtFprintfFloat                444          533  +20.05%
      BenchmarkFmtManyArgs                   1380         1559  +12.97%
      BenchmarkGobDecode                 10240054     11794915  +15.18%
      BenchmarkGobEncode                 17350274     19970478  +15.10%
      BenchmarkGzip                     455179460    460699139   +1.21%
      BenchmarkGunzip                   114271814    119291574   +4.39%
      BenchmarkHTTPClientServer             89051        89894   +0.95%
      BenchmarkJSONEncode                40486799     52691558  +30.15%
      BenchmarkJSONDecode                94193361    112428781  +19.36%
      BenchmarkMandelbrot200              4747060      4748043   +0.02%
      BenchmarkGoParse                    6363798      6675098   +4.89%
      BenchmarkRegexpMatchEasy0_32            129          171  +32.56%
      BenchmarkRegexpMatchEasy0_1K            365          395   +8.22%
      BenchmarkRegexpMatchEasy1_32            106          152  +43.40%
      BenchmarkRegexpMatchEasy1_1K            952         1245  +30.78%
      BenchmarkRegexpMatchMedium_32           198          283  +42.93%
      BenchmarkRegexpMatchMedium_1K         79006       101097  +27.96%
      BenchmarkRegexpMatchHard_32            3478         5115  +47.07%
      BenchmarkRegexpMatchHard_1K          110245       163582  +48.38%
      BenchmarkRevcomp                  777384355    793270857   +2.04%
      BenchmarkTemplate                 136713089    157093609  +14.91%
      BenchmarkTimeParse                     1511         1761  +16.55%
      BenchmarkTimeFormat                     535          850  +58.88%
      
      benchmark                          old MB/s     new MB/s  speedup
      BenchmarkGobDecode                    74.95        65.07    0.87x
      BenchmarkGobEncode                    44.24        38.43    0.87x
      BenchmarkGzip                         42.63        42.12    0.99x
      BenchmarkGunzip                      169.81       162.67    0.96x
      BenchmarkJSONEncode                   47.93        36.83    0.77x
      BenchmarkJSONDecode                   20.60        17.26    0.84x
      BenchmarkGoParse                       9.10         8.68    0.95x
      BenchmarkRegexpMatchEasy0_32         247.24       186.31    0.75x
      BenchmarkRegexpMatchEasy0_1K        2799.20      2591.93    0.93x
      BenchmarkRegexpMatchEasy1_32         299.31       210.44    0.70x
      BenchmarkRegexpMatchEasy1_1K        1074.71       822.45    0.77x
      BenchmarkRegexpMatchMedium_32          5.04         3.53    0.70x
      BenchmarkRegexpMatchMedium_1K         12.96        10.13    0.78x
      BenchmarkRegexpMatchHard_32            9.20         6.26    0.68x
      BenchmarkRegexpMatchHard_1K            9.29         6.26    0.67x
      BenchmarkRevcomp                     326.95       320.40    0.98x
      BenchmarkTemplate                     14.19        12.35    0.87x
      
      R=cshapiro
      CC=golang-dev
      https://golang.org/cl/12616045
      7910cd68
    • Russ Cox's avatar
      doc: update go1.2.txt · 20728966
      Russ Cox authored
      I skimmed the submitted CLs back to Monday.
      
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/12696045
      20728966
    • ChaiShushan's avatar
      strconv: fix typo in docs · 418e2f6a
      ChaiShushan authored
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/12709044
      418e2f6a
    • Mikio Hara's avatar
      net: move InvalidAddrError type into net.go · db84a450
      Mikio Hara authored
      Probably we should remove this type before Go 1 contract has settled,
      but too late. Instead, keep InvalidAddrError close to package generic
      error types.
      
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/12670044
      db84a450
  5. 09 Aug, 2013 7 commits