mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
preallocated capacity for map's certain usege of memory
This commit is contained in:
parent
1d06df1c1f
commit
d4d593e0a1
3 changed files with 4 additions and 4 deletions
|
|
@ -624,7 +624,7 @@ func decodePrealloc(data string) types.GenesisAlloc {
|
|||
acc.Nonce = account.Misc.Nonce
|
||||
acc.Code = account.Misc.Code
|
||||
|
||||
acc.Storage = make(map[common.Hash]common.Hash, len(account.Misc.Slots))
|
||||
acc.Storage = make(map[common.Hash]common.Hash)
|
||||
for _, slot := range account.Misc.Slots {
|
||||
acc.Storage[slot.Key] = slot.Val
|
||||
}
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ type virtualHostHandler struct {
|
|||
}
|
||||
|
||||
func newVHostHandler(vhosts []string, next http.Handler) http.Handler {
|
||||
vhostMap := make(map[string]struct{}, len(vhosts))
|
||||
vhostMap := make(map[string]struct{})
|
||||
for _, allowedHost := range vhosts {
|
||||
vhostMap[strings.ToLower(allowedHost)] = struct{}{}
|
||||
}
|
||||
|
|
@ -636,7 +636,7 @@ func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server) error {
|
|||
log.Error("Unavailable modules in HTTP API list", "unavailable", bad, "available", available)
|
||||
}
|
||||
// Generate the allow list based on the allowed modules
|
||||
allowList := make(map[string]bool, len(modules))
|
||||
allowList := make(map[string]bool)
|
||||
for _, module := range modules {
|
||||
allowList[module] = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ func (s *RPCService) Modules() map[string]string {
|
|||
s.server.services.mu.Lock()
|
||||
defer s.server.services.mu.Unlock()
|
||||
|
||||
modules := make(map[string]string, len(s.server.services.services))
|
||||
modules := make(map[string]string)
|
||||
for name := range s.server.services.services {
|
||||
modules[name] = "1.0"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue