-
Notifications
You must be signed in to change notification settings - Fork 8
/
benchmark_test.go
41 lines (31 loc) · 975 Bytes
/
benchmark_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (C) 2018 rameshvk. All rights reserved.
// Use of this source code is governed by a MIT-style license
// that can be found in the LICENSE file.
package dot_test
import (
"testing"
"github.com/dotchain/dot/changes"
"github.com/dotchain/dot/changes/types"
)
func BenchmarkMergeNonConflicting(b *testing.B) {
left, right := changes.ChangeSet{}, changes.ChangeSet{}
count := 1500
for kk := 0; kk < count; kk++ {
c := changes.Splice{Offset: kk, Before: types.S8(" "), After: types.S8("")}
left = append(left, c)
c.Offset += count
right = append(right, c)
}
changes.Merge(left, right)
}
func BenchmarkMergeConflicting(b *testing.B) {
left, right := changes.ChangeSet{}, changes.ChangeSet{}
count := 1500
for kk := 0; kk < count; kk++ {
c := changes.Splice{Offset: kk, Before: types.S8(" "), After: types.S8("")}
left = append(left, c)
c.Before, c.After = c.After, c.Before
right = append(right, c)
}
changes.Merge(left, right)
}