1. 28 Jun, 2011 14 commits
    • Dmitriy Vyukov's avatar
      runtime: replace Semacquire/Semrelease implementation · 997c00f9
      Dmitriy Vyukov authored
      1. The implementation uses distributed hash table of waitlists instead of a centralized one.
        It significantly improves scalability for uncontended semaphores.
      2. The implementation provides wait-free fast-path for signalers.
      3. The implementation uses less locks (1 lock/unlock instead of 5 for Semacquire).
      4. runtime·ready() call is moved out of critical section.
      5. Semacquire() does not call semwake().
      Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
      are as follows:
      benchmark                                        old ns/op    new ns/op    delta
      runtime_test.BenchmarkSemaUncontended                58.20        36.30  -37.63%
      runtime_test.BenchmarkSemaUncontended-2             199.00        18.30  -90.80%
      runtime_test.BenchmarkSemaUncontended-4             327.00         9.20  -97.19%
      runtime_test.BenchmarkSemaUncontended-8             491.00         5.32  -98.92%
      runtime_test.BenchmarkSemaUncontended-16            946.00         4.18  -99.56%
      
      runtime_test.BenchmarkSemaSyntNonblock               59.00        36.80  -37.63%
      runtime_test.BenchmarkSemaSyntNonblock-2            167.00       138.00  -17.37%
      runtime_test.BenchmarkSemaSyntNonblock-4            333.00       129.00  -61.26%
      runtime_test.BenchmarkSemaSyntNonblock-8            464.00       130.00  -71.98%
      runtime_test.BenchmarkSemaSyntNonblock-16          1015.00       136.00  -86.60%
      
      runtime_test.BenchmarkSemaSyntBlock                  58.80        36.70  -37.59%
      runtime_test.BenchmarkSemaSyntBlock-2               294.00       149.00  -49.32%
      runtime_test.BenchmarkSemaSyntBlock-4               333.00       177.00  -46.85%
      runtime_test.BenchmarkSemaSyntBlock-8               471.00       221.00  -53.08%
      runtime_test.BenchmarkSemaSyntBlock-16              990.00       227.00  -77.07%
      
      runtime_test.BenchmarkSemaWorkNonblock              829.00       832.00   +0.36%
      runtime_test.BenchmarkSemaWorkNonblock-2            425.00       419.00   -1.41%
      runtime_test.BenchmarkSemaWorkNonblock-4            308.00       220.00  -28.57%
      runtime_test.BenchmarkSemaWorkNonblock-8            394.00       147.00  -62.69%
      runtime_test.BenchmarkSemaWorkNonblock-16          1510.00       149.00  -90.13%
      
      runtime_test.BenchmarkSemaWorkBlock                 828.00       813.00   -1.81%
      runtime_test.BenchmarkSemaWorkBlock-2               428.00       436.00   +1.87%
      runtime_test.BenchmarkSemaWorkBlock-4               232.00       219.00   -5.60%
      runtime_test.BenchmarkSemaWorkBlock-8               392.00       251.00  -35.97%
      runtime_test.BenchmarkSemaWorkBlock-16             1524.00       298.00  -80.45%
      
      sync_test.BenchmarkMutexUncontended                  24.10        24.00   -0.41%
      sync_test.BenchmarkMutexUncontended-2                12.00        12.00   +0.00%
      sync_test.BenchmarkMutexUncontended-4                 6.25         6.17   -1.28%
      sync_test.BenchmarkMutexUncontended-8                 3.43         3.34   -2.62%
      sync_test.BenchmarkMutexUncontended-16                2.34         2.32   -0.85%
      
      sync_test.BenchmarkMutex                             24.70        24.70   +0.00%
      sync_test.BenchmarkMutex-2                          208.00        99.50  -52.16%
      sync_test.BenchmarkMutex-4                         2744.00       256.00  -90.67%
      sync_test.BenchmarkMutex-8                         5137.00       556.00  -89.18%
      sync_test.BenchmarkMutex-16                        5368.00      1284.00  -76.08%
      
      sync_test.BenchmarkMutexSlack                        24.70        25.00   +1.21%
      sync_test.BenchmarkMutexSlack-2                    1094.00       186.00  -83.00%
      sync_test.BenchmarkMutexSlack-4                    3430.00       402.00  -88.28%
      sync_test.BenchmarkMutexSlack-8                    5051.00      1066.00  -78.90%
      sync_test.BenchmarkMutexSlack-16                   6806.00      1363.00  -79.97%
      
      sync_test.BenchmarkMutexWork                        793.00       792.00   -0.13%
      sync_test.BenchmarkMutexWork-2                      398.00       398.00   +0.00%
      sync_test.BenchmarkMutexWork-4                     1441.00       308.00  -78.63%
      sync_test.BenchmarkMutexWork-8                     8532.00       847.00  -90.07%
      sync_test.BenchmarkMutexWork-16                    8225.00      2760.00  -66.44%
      
      sync_test.BenchmarkMutexWorkSlack                   793.00       793.00   +0.00%
      sync_test.BenchmarkMutexWorkSlack-2                 418.00       414.00   -0.96%
      sync_test.BenchmarkMutexWorkSlack-4                4481.00       480.00  -89.29%
      sync_test.BenchmarkMutexWorkSlack-8                6317.00      1598.00  -74.70%
      sync_test.BenchmarkMutexWorkSlack-16               9111.00      3038.00  -66.66%
      
      R=rsc
      CC=golang-dev
      https://golang.org/cl/4631059
      997c00f9
    • Brad Fitzpatrick's avatar
      fmt: rename errno and error to err for doc consistency · 39acba55
      Brad Fitzpatrick authored
      The public godoc looked confused. I imagine these were
      written before current conventions were established.
      
      R=golang-dev, rsc
      CC=golang-dev
      https://golang.org/cl/4662060
      39acba55
    • Albert Strasheim's avatar
      runtime/cgo: check for errors from pthread_create · a026d0fc
      Albert Strasheim authored
      R=rsc, iant, dvyukov
      CC=golang-dev
      https://golang.org/cl/4643057
      a026d0fc
    • Dmitriy Vyukov's avatar
      660b2298
    • Dmitriy Vyukov's avatar
      sync: add fast path to Once · 93dde6b0
      Dmitriy Vyukov authored
      The implementation does not grab the lock,
      if Once is already initalized.
      Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
      are as follows:
      benchmark                                        old ns/op    new ns/op    delta
      sync_test.BenchmarkOnce                             187.00        14.00  -92.51%
      sync_test.BenchmarkOnce-2                           909.00        21.40  -97.65%
      sync_test.BenchmarkOnce-4                          3684.00        20.90  -99.43%
      sync_test.BenchmarkOnce-8                          5987.00        23.00  -99.62%
      sync_test.BenchmarkOnce-16                         5051.00        21.60  -99.57%
      
      R=bradfitz, rsc
      CC=golang-dev
      https://golang.org/cl/4641066
      93dde6b0
    • Rob Pike's avatar
      Add the beginnings of the template execution code. Lots still to do, · 81592c29
      Rob Pike authored
      including evaluation up the data tree (in this code all fields must be
      in dot itself), plus more control structure, but the basics are in place.
      
      R=rsc, r
      CC=golang-dev
      https://golang.org/cl/4665041
      81592c29
    • Dmitriy Vyukov's avatar
      sync: replace Mutex benchmarks · 5c15f871
      Dmitriy Vyukov authored
      For both contended and uncontended case:
       - support arbitrary number of cpus (not just 2)
       - dynamic load balancing (improves stability)
       - periodic execution of Gosched() to work around non-preemptiviness
      For uncontended case eliminates possible false-sharing.
      For contended case includes additional variation with some
      amount of local work between mutex operations.
      
      R=r, rsc
      CC=golang-dev
      https://golang.org/cl/4634093
      5c15f871
    • Evan Shaw's avatar
      io.WriteString: if the object has a WriteString method, use it · cf3eeb29
      Evan Shaw authored
      This avoids allocation when writing to bytes.Buffers and bufio.Writers, for
      example.
      
      R=golang-dev, rsc, r, consalus, r
      CC=golang-dev
      https://golang.org/cl/4625068
      cf3eeb29
    • Andrew Gerrand's avatar
      builder: minor fixes · 546c78b7
      Andrew Gerrand authored
      R=golang-dev, gri, bradfitz
      CC=golang-dev
      https://golang.org/cl/4634050
      546c78b7
    • Brad Fitzpatrick's avatar
      mime/multipart: parse LF-delimited messages, not just CRLF · 6282292f
      Brad Fitzpatrick authored
      Against the spec, but appear in the wild.
      
      Fixes #1966
      
      R=golang-dev, adg
      CC=golang-dev
      https://golang.org/cl/4662059
      6282292f
    • Russ Cox's avatar
      exp/regexp/syntax: case-folding in character classes · 52cd055f
      Russ Cox authored
      Also fix \x{123} parsing.
      
      R=r
      CC=golang-dev
      https://golang.org/cl/4632052
      52cd055f
    • Alex Brainman's avatar
    • Russ Cox's avatar
      cc: add two new #pragma varargck · fe2ccb53
      Russ Cox authored
      #pragma varargck countpos f 1
      says that the first argument to f is
      the count of variadic arguments that follow.
      
      #pragma varargck type f t
      says that t is one of the allowed types for
      a variadic argument to f.
      (can be repeated)
      
      combined, these can be used to check the
      runtime.stdcall functions in the windows port
      or in any other port that needs a vararg list of
      uintptrs even on a 64-bit platform (where it is
      very easy to pass a less-than-uintptr in the ...).
      
      demo:
      
      typedef unsigned int uintptr;
      
      #pragma varargck countpos f 1
      #pragma varargck type f uintptr
      #pragma varargck type f void*
      
      int f(int count, ...);
      
      void *v;
      char *p;
      
      void
      main(void)
      {
              f(1, v);  // ok
              f(1, main);  // ok
              f(1, p);  // ok
              f(2, v, v);  // ok
      
              f(2, v);  // found 1 argument after count 2
              f(1, 'a');  // invalid type INT in call to f
              f(1, 0);  // invalid type INT in call to f
      }
      
      R=ken, r, alex.brainman
      CC=golang-dev
      https://golang.org/cl/4634103
      fe2ccb53
    • Rob Pike's avatar
      os: simplify WriteString · f7115327
      Rob Pike authored
      It was working too hard.
      
      R=golang-dev, adg
      CC=golang-dev
      https://golang.org/cl/4639081
      f7115327
  2. 27 Jun, 2011 21 commits
  3. 26 Jun, 2011 1 commit
  4. 25 Jun, 2011 3 commits
  5. 24 Jun, 2011 1 commit
    • Brad Fitzpatrick's avatar
      http: better handling of 0-length Request.Body · 5d4eea6a
      Brad Fitzpatrick authored
      As rsc suggested after change 58a6bdac3d12 was committed, we
      now read the first byte of Request.Body when the
      Request.ContentLength is 0 to disambiguate between a truly
      zero-length body and a body of unknown length where the user
      didn't set the ContentLength field.
      
      This was also causing the reverse proxy problem where incoming
      requests (which always have a body, of private type http.body,
      even for 0-lengthed requests) were being relayed to the http
      Transport for fetching, which was serializing the request as a
      chunked request (since ContentLength was 0 and Body was
      non-nil)
      
      Fixes #1999
      
      R=golang-dev, kevlar
      CC=golang-dev
      https://golang.org/cl/4628063
      5d4eea6a