Skip to content

Commit 04bdeed

Browse files
committed
Optimizing buffer
1 parent 3b545c0 commit 04bdeed

3 files changed

Lines changed: 2 additions & 12 deletions

File tree

core/buffer/bytes.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package buffer
33
import (
44
"sync"
55
"sync/atomic"
6-
7-
"github.com/dobyte/due/v2/log"
86
)
97

108
type Bytes struct {
@@ -18,9 +16,7 @@ var _ Buffer = (*Bytes)(nil)
1816

1917
// NewBytes 以指定buf创建字节
2018
func NewBytes(buf []byte) *Bytes {
21-
b := &Bytes{buf: buf, off: len(buf)}
22-
log.Errorf("Bytes Malloc %p, acquire cap: %d, actual cap: %d\n", b, len(buf), b.Cap())
23-
return b
19+
return &Bytes{buf: buf, off: len(buf)}
2420
}
2521

2622
// NewBytesWithCapacity 以指定容量创建字节
@@ -66,8 +62,6 @@ func (b *Bytes) Bytes() []byte {
6662

6763
// Release 释放
6864
func (b *Bytes) Release() {
69-
log.Errorf("Bytes Release %p, cap: %d\n", b, b.Cap())
70-
7165
b.off = 0
7266

7367
if b.pool != nil {

core/buffer/bytes_pool.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package buffer
33
import (
44
"math"
55
"sync"
6-
7-
"github.com/dobyte/due/v2/log"
86
)
97

108
var defaultBytesPool = NewBytesPool(32)
@@ -50,8 +48,6 @@ func (p *BytesPool) Get(cap int) *Bytes {
5048
b.off = cap
5149
b.released.Store(false)
5250

53-
log.Errorf("Bytes Malloc %p, acquire cap: %d, actual cap: %d\n", b, cap, b.Cap())
54-
5551
return b
5652
}
5753

internal/transporter/internal/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
const (
1616
defaultTimeout = 3 * time.Second // 调用超时时间
17-
defaultConnNum = 1 // 默认连接数
17+
defaultConnNum = 10 // 默认连接数
1818
)
1919

2020
type chWrite struct {

0 commit comments

Comments
 (0)