| // +build linux,amd64 linux,ppc64le darwin,amd64 freebsd,amd64 netbsd,amd64 windows,amd64 |
| // Copyright 2016 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| const benchmarkNumNodes = 10000 |
| func BenchmarkUpdateNodeTransaction(b B) { |
| s, nodeIDs := setupNodes(benchmarkNumNodes) |
| for i := 0; i < b.N(); i++ { |
| _ = s.Update(func(tx1 Tx) error { |
| _ = UpdateNode(tx1, &Node{ |
| ID: nodeIDs[i%benchmarkNumNodes], |
| type MemoryStore struct { |
| func setupNodes(n int) (s *MemoryStore, nodeIDs []string) { |
| func (s *MemoryStore) Update(cb func(Tx) error) error { |
| func UpdateNode(tx Tx, n *Node) error { |