Skip to content

Commit

Permalink
更新包名
Browse files Browse the repository at this point in the history
  • Loading branch information
guonaihong committed May 17, 2023
1 parent eab82a7 commit a214938
Show file tree
Hide file tree
Showing 59 changed files with 83 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Please answer these questions before submitting your issue. Thanks!

### 3. What did you see instead (Required)

### 4. What is your deepcopy version? (Required)
### 4. What is your pcopy version? (Required)
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/general-question.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Before asking a question, make sure you have:
- Searched existing Stack Overflow questions.
- Googled your question.
- Searched open and closed [GitHub issues](https://github.com/antlabs/deepcopy/issues)
- Searched open and closed [GitHub issues](https://github.com/antlabs/pcopy/issues)
- Read the documentation:
- [deepcopy Readme](https://github.com/antlabs/deepcopy/blob/master/README.md)
- [deepcopy Readme](https://github.com/antlabs/pcopy/blob/master/README.md)
-->
-->
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## 作用
[![Go](https://github.com/antlabs/dcopy/workflows/Go/badge.svg)](https://github.com/antlabs/dcopy/actions)
[![codecov](https://codecov.io/gh/antlabs/dcopy/branch/master/graph/badge.svg)](https://codecov.io/gh/antlabs/dcopy)
[![Go](https://github.com/antlabs/pcopy/workflows/Go/badge.svg)](https://github.com/antlabs/pcopy/actions)
[![codecov](https://codecov.io/gh/antlabs/pcopy/branch/master/graph/badge.svg)](https://codecov.io/gh/antlabs/pcopy)

`dcopy.Copy`主要用于两个类型间的深度拷贝, 前身是[deepcopy](https://github.com/antlabs/deepcopy)
`pcopy.Copy`主要用于两个类型间的深度拷贝, 前身是[deepcopy](https://github.com/antlabs/deepcopy)

新加预热函数。Copy时打开加速开关,达到性能提升4-10倍的效果。

警告:

高性能的同时可能会有些bug, 如果发现bug可以去掉`dcopy.WithUsePreheat()`试下, 结果不一致,可以提issue。
高性能的同时可能会有些bug, 如果发现bug可以去掉`pcopy.WithUsePreheat()`试下, 结果不一致,可以提issue。

## feature
* 高性能, 相对第一个版本提升4-10倍的性能
Expand All @@ -25,7 +25,7 @@
- [性能压测](#benchmark)
## Installation
```
go get github.com/antlabs/dcopy
go get github.com/antlabs/pcopy
```

## Quick start
Expand All @@ -34,7 +34,7 @@ package main

import (
"fmt"
"github.com/antlabs/dcopy"
"github.com/antlabs/pcopy"
)

type dst struct {
Expand All @@ -48,8 +48,8 @@ type src struct{
}
func main() {
d, s := dst{}, src{ID:3}
dcopy.Preheat(&dst{}, &src{}) // 一对类型只要预热一次
dcopy.Copy(&d, &s, dcopy.WithUsePreheat())
pcopy.Preheat(&dst{}, &src{}) // 一对类型只要预热一次
pcopy.Copy(&d, &s, pcopy.WithUsePreheat())
fmt.Printf("%#v\n", d)

}
Expand All @@ -63,15 +63,15 @@ package main
import (
"fmt"

"github.com/antlabs/dcopy"
"github.com/antlabs/pcopy"
)

func main() {
i := []int{1, 2, 3, 4, 5, 6}
var o []int

dcopy.Preheat(&o, &i)
dcopy.Copy(&o, &i, dcopy.WithUsePreheat())
pcopy.Preheat(&o, &i)
pcopy.Copy(&o, &i, pcopy.WithUsePreheat())

fmt.Printf("%#v\n", o)
}
Expand All @@ -85,7 +85,7 @@ package main
import (
"fmt"

"github.com/antlabs/dcopy"
"github.com/antlabs/pcopy"
)

func main() {
Expand All @@ -97,15 +97,15 @@ func main() {
}

var o map[string]int
dcopy.Preheat(&o, &i)
dcopy.Copy(&o, &i, dcopy.WithUsePreheat())
pcopy.Preheat(&o, &i)
pcopy.Copy(&o, &i, pcopy.WithUsePreheat())

fmt.Printf("%#v\n", o)
}

```
## simplify business code development
经常看到,对同一个结构体的,有值更新操作,都是一堆手工if 然后赋值的代码。不仅容易出错,还累。快使用dcopy解放双手
经常看到,对同一个结构体的,有值更新操作,都是一堆手工if 然后赋值的代码。不仅容易出错,还累。快使用pcopy解放双手
```go
type option struct {
Int int
Expand All @@ -127,20 +127,20 @@ func main() {
a.S = b.S
}

dcopy.Preheat(&a, &b) //只要预热一次
pcopy.Preheat(&a, &b) //只要预热一次
//可以约化成
dcopy.Copy(&a, &b, dcopy.WithUsePreheat())
pcopy.Copy(&a, &b, pcopy.WithUsePreheat())
}
```
# benchmark
从零实现的dcopy相比json序列化与反序列化方式拥有更好的性能
从零实现的pcopy相比json序列化与反序列化方式拥有更好的性能
```
goos: linux
goarch: amd64
pkg: github.com/antlabs/dcopy
pkg: github.com/antlabs/pcopy
Benchmark_MiniCopy-16 159084 6737 ns/op
Benchmark_dcopy-16 374920 2895 ns/op
Benchmark_pcopy-16 374920 2895 ns/op
PASS
ok github.com/antlabs/dcopy 2.275s
ok github.com/antlabs/pcopy 2.275s
```
2 changes: 1 addition & 1 deletion cache.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"reflect"
Expand Down
2 changes: 1 addition & 1 deletion dcopy.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_basetype_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_base_map_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_base_slice_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_base_type_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_composite_map_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_getlikefavorited_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_getredpoint_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_interface_base_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_interface_slice_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_ptr_base_type1_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_ptr_baseslice_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion dcopy_benchmark_slice_with_struct_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import "testing"

Expand Down
2 changes: 1 addition & 1 deletion dcopy_better_to_use_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_dst_ptr_struct_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_enum_fix2_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_fix_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_func_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_getlikefavorited_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_getredpoint_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_have_value_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_interface_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_map_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_ptr_basemap_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_ptr_baseslice_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_ptr_basetype_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_ptr_double_basetype_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_ptr_struct_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_readme_example_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_slice_and_array_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_slice_basetype_ptr_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_slice_struct_ptr_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dcopy
package pcopy

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_struct_basetype_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"reflect"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_struct_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion dcopy_struct_with_struct_test.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy
2 changes: 1 addition & 1 deletion dcopy_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright [2020-2023] [guonaihong]
package dcopy
package pcopy

import (
"testing"
Expand Down
Loading

0 comments on commit a214938

Please sign in to comment.