mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
Optimize: map or slice initialize allocation size / cap (#1965)
This commit is contained in:
@@ -3030,11 +3030,11 @@ func (ctx *Context) ReadMultipartRelated() (MultipartRelated, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func distinctStrings(values []string) (result []string) {
|
||||
seen := make(map[string]struct{})
|
||||
func distinctStrings(values []string) []string {
|
||||
seen := make(map[string]struct{}, len(values))
|
||||
result := make([]string, 0, len(values))
|
||||
|
||||
for v := range values {
|
||||
val := values[v]
|
||||
for _, val := range values {
|
||||
if _, ok := seen[val]; !ok {
|
||||
seen[val] = struct{}{}
|
||||
result = append(result, val)
|
||||
|
||||
Reference in New Issue
Block a user