forked from Restream/reindexer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench_text_test.go
63 lines (59 loc) · 3.19 KB
/
bench_text_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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"testing"
"github.com/restream/reindexer/benchmarks/repo"
)
func BenchmarkElasticFullText(b *testing.B) {
repo.Get("elastic").QueryFullText(func() string { return randStringWord() + " " + randStringWord() }, b.N, 10)
}
func BenchmarkMongoFullText(b *testing.B) {
repo.Get("mongo").QueryFullText(func() string { return randStringWord() + " " + randStringWord() }, b.N, 10)
}
func BenchmarkSqliteFullText(b *testing.B) {
repo.Get("sqlite").QueryFullText(func() string { return randStringWord() + " OR " + randStringWord() }, b.N, 10)
}
func BenchmarkMysqlFullText(b *testing.B) {
repo.Get("mysql").QueryFullText(func() string { return randStringWord() + " " + randStringWord() }, b.N, 10)
}
func BenchmarkSphinxFullText(b *testing.B) {
repo.Get("sphinx").QueryFullText(func() string { return "=" + randStringWord() + " | " + "=" + randStringWord() }, b.N, 10)
}
func BenchmarkReindexFullText(b *testing.B) {
repo.Get("reindex").QueryFullText(func() string { return "=" + randStringWord() + " =" + randStringWord() }, b.N, 10)
}
func BenchmarkArangoFullText(b *testing.B) {
repo.Get("arango").QueryFullText(func() string { return randStringWord() + ",|" + randStringWord() }, b.N, 10)
}
func BenchmarkElasticFullTextPref(b *testing.B) {
repo.Get("elastic").QueryFullText(func() string { return randStringPref() + "* " + randStringPref() + "* " }, b.N, 10)
}
func BenchmarkSqliteFullTextPref(b *testing.B) {
repo.Get("sqlite").QueryFullText(func() string { return randStringPref() + "* OR " + randStringPref() + "*" }, b.N, 10)
}
func BenchmarkMysqlFullTextPref(b *testing.B) {
repo.Get("mysql").QueryFullText(func() string { return randStringPref() + "* " + randStringPref() + "*" }, b.N, 10)
}
func BenchmarkSphinxFullTextPref(b *testing.B) {
repo.Get("sphinx").QueryFullText(func() string { return randStringPref() + "* | " + randStringPref() + "*" }, b.N, 10)
}
func BenchmarkReindexFullTextPref(b *testing.B) {
repo.Get("reindex").QueryFullText(func() string { return randStringPref() + "* " + randStringPref() + "* " }, b.N, 10)
}
func BenchmarkArangoFullTextPref(b *testing.B) {
repo.Get("arango").QueryFullText(func() string { return "prefix:" + randStringPref() + ",|prefix:" + randStringPref() + "* " }, b.N, 10)
}
func BenchmarkElasticFullText3Fuzzy(b *testing.B) {
repo.Get("elastic").QueryFullText(func() string { return randStringWord() + "*~ " + randStringWord() + "*~ " + randStringWord() + "*~ " }, b.N, 10)
}
func BenchmarkSqliteFullText3Fuzzy(b *testing.B) {
repo.Get("sqlite").QueryFullText(func() string { return randStringWord() + "* OR " + randStringWord() + "* OR " + randStringWord() + "*" }, b.N, 10)
}
func BenchmarkMysqlFullText3Fuzzy(b *testing.B) {
repo.Get("mysql").QueryFullText(func() string { return randStringWord() + "* " + randStringWord() + "* " + randStringWord() + "*" }, b.N, 10)
}
func BenchmarkSphinxFullText3Fuzzy(b *testing.B) {
repo.Get("sphinx").QueryFullText(func() string { return randStringWord() + "* | " + randStringWord() + "* | " + randStringWord() + "*" }, b.N, 10)
}
func BenchmarkReindexFullText3Fuzzy(b *testing.B) {
repo.Get("reindex").QueryFullText(func() string { return randStringWord() + "*~ " + randStringWord() + "*~ " + randStringWord() + "*~ " }, b.N, 10)
}