FAQ
Reviewers: golang-dev1,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://code.google.com/p/go


Description:
sort: use a very fast random generator for benchmarks

Adapted from https://codereview.appspot.com/11564044.

Fixes breakage of darwin-amd64-race builder.

Please review this at https://codereview.appspot.com/13352045/

Affected files:
    M src/pkg/sort/sort_test.go


Index: src/pkg/sort/sort_test.go
===================================================================
--- a/src/pkg/sort/sort_test.go
+++ b/src/pkg/sort/sort_test.go
@@ -520,10 +520,16 @@
   func bench(b *testing.B, size int, algo func(Interface), name string) {
    b.StopTimer()
    data := make(intPairs, size)
+ x := ^uint32(0)
    for i := 0; i < b.N; i++ {
     for n := size - 3; n <= size+3; n++ {
      for i := 0; i < len(data); i++ {
- data[i].a = rand.Intn(n / 5)
+ x += x
+ x ^= 1
+ if int32(x) < 0 {
+ x ^= 0x88888eef
+ }
+ data[i].a = int(x % uint32(n/5))
      }
      data.initB()
      b.StartTimer()


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • R at Aug 29, 2013 at 1:41 am
    LGTM
    love that generator


    https://codereview.appspot.com/13352045/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave Cheney at Aug 29, 2013 at 1:43 am
    This helps a bit, not as much as the regexp application, but it might
    help get this test in under the 10 minute window. If it still fails, I
    look to disabling some of the 1e6 benchmarks in -race mode.
    On Thu, Aug 29, 2013 at 11:41 AM, wrote:
    LGTM
    love that generator


    https://codereview.appspot.com/13352045/
    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave at Aug 29, 2013 at 3:21 am
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=4f4edc2ddd93 ***

    sort: use a very fast random generator for benchmarks

    Adapted from https://codereview.appspot.com/11564044.

    Fixes breakage of darwin-amd64-race builder.

    R=golang-dev, r
    CC=golang-dev
    https://codereview.appspot.com/13352045


    https://codereview.appspot.com/13352045/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave Cheney at Aug 29, 2013 at 5:14 am
    Damnit, still too slow

    *** Test killed with quit: ran too long (10m0s).
    FAIL regexp 600.104s
    ok regexp/syntax 25.115s
    ok runtime 77.823s
    ? runtime/cgo [no test files]
    ok runtime/debug 1.099s
    ok runtime/pprof 1.074s
    ok runtime/race 1.148s
    *** Test killed with quit: ran too long (10m0s).
    FAIL sort 600.094s
    On Thu, Aug 29, 2013 at 1:21 PM, wrote:
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=4f4edc2ddd93 ***


    sort: use a very fast random generator for benchmarks

    Adapted from https://codereview.appspot.com/11564044.

    Fixes breakage of darwin-amd64-race builder.

    R=golang-dev, r
    CC=golang-dev
    https://codereview.appspot.com/13352045


    https://codereview.appspot.com/13352045/
    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rob Pike at Aug 29, 2013 at 5:18 am
    instead of fighting it, why not just set a longer timeout?

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave Cheney at Aug 29, 2013 at 5:45 am
    It's a bit tricky, this is the last ditch timeout inside the go process, not the test process.

    Ill try.
    On 29/08/2013, at 15:18, Rob Pike wrote:

    instead of fighting it, why not just set a longer timeout?
    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Russ Cox at Sep 5, 2013 at 2:43 pm
    Why are we running benchmarks on the race detector builder?
    We don't run them on anything else?

    If we have to run benchmarks to exercise more code paths, can't we pass
    something like -benchtime=0.01s?

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dmitry Vyukov at Sep 5, 2013 at 2:50 pm

    On Thu, Sep 5, 2013 at 6:43 PM, Russ Cox wrote:
    Why are we running benchmarks on the race detector builder?
    It has uncovered several bugs. E.g. most http benchmarks are not
    concurrent (single request), while benchmarks stress concurrent
    requests.
    Probably it also uncovered some bugs in instrumentation because of
    larger code coverage.
    On the other hand race builders do not run test/api/cgo/etc, so they
    usually finish ahead of normal builders.
    We don't run them on anything else?
    dunno
    it may be useful for stability testing

    If we have to run benchmarks to exercise more code paths, can't we pass
    something like -benchtime=0.01s?
    We do pass -benchtime=0.01s, or .1s, don't remember exactly.
    There are some benchmarks where 1 iteration takes seconds.

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave Cheney at Sep 11, 2013 at 12:55 am
    I think the issue may have been solved by this CL
    https://codereview.appspot.com/13650043 which will prevent benchmarks
    running in parallel.
    On Fri, Sep 6, 2013 at 12:49 AM, Dmitry Vyukov wrote:
    On Thu, Sep 5, 2013 at 6:43 PM, Russ Cox wrote:
    Why are we running benchmarks on the race detector builder?
    It has uncovered several bugs. E.g. most http benchmarks are not
    concurrent (single request), while benchmarks stress concurrent
    requests.
    Probably it also uncovered some bugs in instrumentation because of
    larger code coverage.
    On the other hand race builders do not run test/api/cgo/etc, so they
    usually finish ahead of normal builders.
    We don't run them on anything else?
    dunno
    it may be useful for stability testing

    If we have to run benchmarks to exercise more code paths, can't we pass
    something like -benchtime=0.01s?
    We do pass -benchtime=0.01s, or .1s, don't remember exactly.
    There are some benchmarks where 1 iteration takes seconds.
    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedAug 29, '13 at 1:33a
activeSep 11, '13 at 12:55a
posts10
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase