Skip to content

Commit

Permalink
Minor perf improvement with exgws
Browse files Browse the repository at this point in the history
On every pod add we assemble a new slice with all of the gatewayInfos.
This had no capacity, so every append was an underlying array copy.
Attempt to allocate at least some predictable capacity to avoid this.

Signed-off-by: Tim Rozet <trozet@redhat.com>
  • Loading branch information
trozet committed Jan 7, 2022
1 parent d1032a6 commit 87368a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go-controller/pkg/ovn/pods.go
Expand Up @@ -458,7 +458,7 @@ func (oc *Controller) addLogicalPort(pod *kapi.Pod) (err error) {
}

// if we have any external or pod Gateways, add routes
gateways := make([]*gatewayInfo, 0)
gateways := make([]*gatewayInfo, 0, len(routingExternalGWs.gws)+len(routingPodGWs))

if len(routingExternalGWs.gws) > 0 {
gateways = append(gateways, routingExternalGWs)
Expand Down

0 comments on commit 87368a7

Please sign in to comment.