Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(268)

Delta Between Two Patch Sets: test/bench/go/asop_test.go

Issue 6819087: code review 6819087: test/bench/go: new package (Closed)
Left Patch Set: diff -r f781c447da6e https://code.google.com/p/go Created 11 years, 4 months ago
Right Patch Set: diff -r a53601cd4e63 https://code.google.com/p/go Created 11 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | test/bench/go/divmul_test.go » ('j') | test/bench/go/divmul_test.go » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 var x int
10
11 func BenchmarkAdd(b *testing.B) {
12 v := 0
13 for i := 0; i < b.N; i++ {
14 v += 1
15 }
16 x += v
17 }
18
19 func BenchmarkSub(b *testing.B) {
20 v := 0
21 for i := 0; i < b.N; i++ {
22 v -= 1
23 }
24 x += v
25 }
26
27 func BenchmarkLSL(b *testing.B) {
28 v := 0
29 for i := 0; i < b.N; i++ {
30 v <<= 1
31 }
32 x += v
33 }
34
35 func BenchmarkLSR(b *testing.B) {
36 v := 0
37 for i := 0; i < b.N; i++ {
38 v >>= 1
39 }
40 x += v
41 }
42
43 func BenchmarkOR(b *testing.B) {
44 v := 0
45 for i := 0; i < b.N; i++ {
46 v |= 1
47 }
48 x += v
49 }
50
51 func BenchmarkXOR(b *testing.B) {
52 v := 0
53 for i := 0; i < b.N; i++ {
54 v ^= 1
55 }
56 x += v
57 }
58
59 func BenchmarkAND(b *testing.B) {
60 v := 0
61 for i := 0; i < b.N; i++ {
62 v &= 1
63 }
64 x += v
65 }
66
67 func BenchmarkANDNOT(b *testing.B) {
68 v := 0
69 for i := 0; i < b.N; i++ {
70 v &^= 1
71 }
72 x += v
73 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b