mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-13 17:22:27 +08:00
Pre-allocate memory to reduce the number of allocations (#272)
This commit is contained in:
@@ -74,7 +74,7 @@ func ToBytes(value any) ([]byte, error) {
|
||||
// ToChar convert string to char slice.
|
||||
// Play: https://go.dev/play/p/JJ1SvbFkVdM
|
||||
func ToChar(s string) []string {
|
||||
c := make([]string, 0)
|
||||
c := make([]string, 0, len(s))
|
||||
if len(s) == 0 {
|
||||
c = append(c, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user