node/endpoints: prealloc map in checkModuleAvailability

This commit is contained in:
rizkyikiw42 2025-10-25 16:19:44 +08:00
parent 17e5222997
commit e1ad307099

View file

@ -53,7 +53,7 @@ func StartHTTPEndpoint(endpoint string, timeouts rpc.HTTPTimeouts, handler http.
// available API services. It assumes that the MetadataApi module ("rpc") is always available;
// the registration of this "rpc" module happens in NewServer() and is thus common to all endpoints.
func checkModuleAvailability(modules []string, apis []rpc.API) (bad, available []string) {
availableSet := make(map[string]struct{})
availableSet := make(map[string]struct{}, len(apis))
for _, api := range apis {
if _, ok := availableSet[api.Namespace]; !ok {
availableSet[api.Namespace] = struct{}{}