ecodeclub / ekit

支持泛型的工具库
https://doc.meoying.com/
Apache License 2.0
383 stars 164 forks source link

优化Add内存分配及执行效率 #261

Closed dhqhawk closed 1 month ago

dhqhawk commented 1 month ago

新写的Add通过了add.test中的测试。并且我在测试中增加了新旧Add的测试对比,对比结果如下 pkg: github.com/ecodeclub/ekit/internal/slice cpu: AMD Ryzen 7 6800H with Radeon Graphics
Benchmark_Add Benchmark_Add/Newadd Benchmark_Add/Newadd-16 23971473 54.40 ns/op 48 B/op 1 allocs/op Benchmark_Add/Oldadd Benchmark_Add/Oldadd-16 18766801 69.49 ns/op 80 B/op 1 allocs/op