Skip to content

Commit 90b345b

Browse files
committed
完善性能测试
1 parent 8702584 commit 90b345b

File tree

3 files changed

+197
-63
lines changed

3 files changed

+197
-63
lines changed

README.en.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,12 @@ $ go test -v ./_examples/performance_test.go
110110
111111
> Environment:R7-5800X CPU @ 3.8GHZ GHZ, 32 GB RAM
112112
113-
| tests | write time (less is better) | read time (less is better) | mixed-operation time (less is better) |
114-
|-------------|-----------------------------|----------------------------|---------------------------------------|
115-
| **cachego** | **965ms** | **949ms** | **991ms** |
116-
| go-cache | 3216ms | 980ms | 4508ms |
117-
| freeCache | 954ms | 968ms | 987ms |
113+
| tests | read time (less is better) | write time (less is better) | mixed-operation time (less is better) |
114+
|-------------|----------------------------|-----------------------------|---------------------------------------|
115+
| **cachego** | **945ms** | **942ms** | **941ms** |
116+
| go-cache | 965ms | 3251ms | 4390ms |
117+
| freeCache | 935ms | 994ms | 1012ms |
118+
| ECache | 931ms | 1068ms | 1071ms |
118119

119120
As you can see, cachego has a high performance in concurrent, but segmented lock mechanism has one-more-time positioning
120121
operation, so if the price of locking is less than the cost of positioning, this mechanism is dragging. The reading

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,12 @@ $ go test -v ./_examples/performance_test.go
109109
110110
> 测试环境:R7-5800X CPU @ 3.8GHZ GHZ,32 GB RAM
111111
112-
| 测试 | 写入消耗时间 (越小越好) | 读取消耗时间 (越小越好) | 混合操作消耗时间 (越小越好) |
112+
| 测试 | 读取消耗时间 (越小越好) | 写入消耗时间 (越小越好) | 混合操作消耗时间 (越小越好) |
113113
|-------------|---------------|---------------|-----------------|
114-
| **cachego** | **965ms** | **949ms** | **991ms** |
115-
| go-cache | 3216ms | 980ms | 4508ms |
116-
| freeCache | 954ms | 968ms | 987ms |
114+
| **cachego** | **945ms** | **942ms** | **941ms** |
115+
| go-cache | 965ms | 3251ms | 4390ms |
116+
| freeCache | 935ms | 994ms | 1012ms |
117+
| ECache | 931ms | 1068ms | 1071ms |
117118

118119
可以看出,由于使用了分段锁机制,读写性能在并发下依然非常高,但是分段锁会多一次定位的操作,如果加锁的消耗小于定位的消耗,那分段锁就不占优势。 这也是为什么 cachego 在写入性能上比 go-cache
119120
强一大截,但是读取性能却没强多少的原因。后续会着重优化读取性能!

0 commit comments

Comments
 (0)