From 85ca7c5b95cdf1e557abb38a283d1e61a5959c31 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 23 Mar 2020 20:04:34 +0100 Subject: [PATCH] unix: allocate signalNameMap with enough space Avoid re-allocations while filling signalNameMap. Change-Id: I3017e856c2724debccad43324cbe2e60b68d869c Reviewed-on: https://go-review.googlesource.com/c/sys/+/225017 Run-TryBot: Tobias Klauser Reviewed-by: Ian Lance Taylor TryBot-Result: Gobot Gobot --- unix/syscall_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/syscall_unix.go b/unix/syscall_unix.go index 3de37566c..8f710d014 100644 --- a/unix/syscall_unix.go +++ b/unix/syscall_unix.go @@ -76,7 +76,7 @@ func SignalName(s syscall.Signal) string { // The signal name should start with "SIG". func SignalNum(s string) syscall.Signal { signalNameMapOnce.Do(func() { - signalNameMap = make(map[string]syscall.Signal) + signalNameMap = make(map[string]syscall.Signal, len(signalList)) for _, signal := range signalList { signalNameMap[signal.name] = signal.num }