MCPcopy Create free account
hub / github.com/33cn/chain33 / BenchmarkChanSub3

Function BenchmarkChanSub3

queue/queue_test.go:406–422  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

404}
405
406func BenchmarkChanSub3(b *testing.B) {
407 q := New("channel")
408 client := q.Client()
409 client.Sub("hello")
410
411 go func() {
412 for i := 0; i < b.N; i++ {
413 sub := q.(*queue).chanSub("hello")
414 msg := NewMessage(1, "", 0, nil)
415 sub.high <- msg
416 }
417 }()
418 for i := 0; i < b.N; i++ {
419 msg := <-client.Recv()
420 msg.Reply(msg)
421 }
422}
423
424func BenchmarkChanSub4(b *testing.B) {
425 q := New("channel")

Callers

nothing calls this directly

Calls 7

ReplyMethod · 0.95
chanSubMethod · 0.80
NewFunction · 0.70
NewMessageFunction · 0.70
ClientMethod · 0.65
SubMethod · 0.65
RecvMethod · 0.65

Tested by

no test coverage detected