Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
documents
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
袁兴强
documents
Commits
85674d8a
Commit
85674d8a
authored
Dec 14, 2021
by
yxq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ref docs
parent
41606403
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
Chain33语言层面性能优化记录.md
Chain33语言层面性能优化记录.md
+10
-1
No files found.
Chain33语言层面性能优化记录.md
View file @
85674d8a
// chain33/common/db/mvcc.go L:427
```
Go
// chain33/common/db/mvcc.go L:427
func pad(version int64) []byte {
s := fmt.Sprintf("%020d", version)
...
...
@@ -26,6 +28,9 @@ func pad3(version int64, padLen int) []byte {
return result
}
```
```
Go
// chain33/common/db/mvcc.go L:432
func GetKeyPerfix(key []byte) []byte {
b := append([]byte{}, mvccData...)
...
...
@@ -43,6 +48,9 @@ func GetKeyPerfix2(key []byte) []byte {
return newKey
}
```
```
Go
// chain33/util/exec.go L:226
func DelDupKey(kvs []*types.KeyValue) []*types.KeyValue {
dupindex := make(map[string]int)
...
...
@@ -85,3 +93,4 @@ BenchmarkDelDupKey2 171 7748627 ns/op 2254615 B/
由于[]byte不可比较因此不能作为map的key,通常把[]byte转换成string后作为map的key。如果在map的方括号内进行类型转换,Go编译器会进行优化,复用相同的string,避免重复申请内存
*/
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment