~samwhited/xmpp

ref: 9de4741175d45b83a633236062ac812886548e05 xmpp/benchmark_test.go -rw-r--r-- 687 bytes
9de47411Sam Whited Add unsafe (quick) Jid constructors 5 years ago
                                                                                
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
// Copyright 2014 Sam Whited.
// Use of this source code is governed by the BSD 2-clause license that can be
// found in the LICENSE file.

package jid

import (
	"testing"
)

func BenchmarkJidFromString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		FromString("user@example.com/resource")
	}
}

func BenchmarkJidFromStringUnsafe(b *testing.B) {
	for i := 0; i < b.N; i++ {
		FromStringUnsafe("user@example.com/resource")
	}
}

func BenchmarkJidFromParts(b *testing.B) {
	for i := 0; i < b.N; i++ {
		FromParts("user", "example.com", "resource")
	}
}

func BenchmarkJidFromPartsUnsafe(b *testing.B) {
	for i := 0; i < b.N; i++ {
		FromPartsUnsafe("user", "example.com", "resource")
	}
}