Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2012 The Go Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style | |
3 // license that can be found in the LICENSE file. | |
4 | |
5 package bench | |
6 | |
7 import "testing" | |
8 | |
9 func BenchmarkLSL(b *testing.B) { | |
r
2012/11/07 16:12:40
it seems if you have these, you might as well fini
dfc
2012/11/08 01:20:34
Done.
| |
10 for i, v := 0, 0; i < b.N; i++ { | |
11 v <<= 1 | |
12 } | |
rsc
2012/11/07 14:25:40
I would suggest add a global
var x int
and then
dfc
2012/11/08 01:20:34
Done.
| |
13 } | |
14 | |
15 func BenchmarkLSR(b *testing.B) { | |
16 for i, v := 0, 0; i < b.N; i++ { | |
17 v >>= 1 | |
18 } | |
19 } | |
20 | |
21 func BenchmarkOREQ(b *testing.B) { | |
22 for i, v := 0, 0; i < b.N; i++ { | |
23 v |= 1 | |
24 } | |
25 } | |
26 | |
27 func BenchmarkANDEQ(b *testing.B) { | |
28 for i, v := 0, 0; i < b.N; i++ { | |
29 v &= 1 | |
30 } | |
31 } | |
32 | |
33 func BenchmarkDiv2(b *testing.B) { | |
34 for i, v := 0, 0; i < b.N; i++ { | |
35 v /= 2 | |
36 } | |
37 } | |
OLD | NEW |