mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-01 23:56:38 +08:00
perf: preallocate array capacity
This commit is contained in:
parent
fe291359a2
commit
03727a92c8
@ -86,7 +86,7 @@ func AddChannel(c *gin.Context) {
|
||||
}
|
||||
channel.CreatedTime = common.GetTimestamp()
|
||||
keys := strings.Split(channel.Key, "\n")
|
||||
channels := make([]model.Channel, 0)
|
||||
channels := make([]model.Channel, 0, len(keys))
|
||||
for _, key := range keys {
|
||||
if key == "" {
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user