]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Optimize IptablesManager._find_last_entry
authorAssaf Muller <amuller@redhat.com>
Fri, 15 May 2015 21:58:13 +0000 (17:58 -0400)
committerAssaf Muller <amuller@redhat.com>
Fri, 15 May 2015 21:58:13 +0000 (17:58 -0400)
commitbf71868ba809587b72da68b8cd4c248cf33990a1
tree03585bbfe7df69e5b6d2ea8c77f86a653c6b368e
parent5315fc27bdda487380552771d9a0ab5af4b6a48b
Optimize IptablesManager._find_last_entry

As it turns out calling .strip() thousands of times can be expensive.
I'll defer to security groups and iptables experts to try and find ways
to call the method less often, cache the results, or any other clever
trick.

Moving strip to the return statement speeds up the method by more than
x2.

Change-Id: I7522c6db50c76274bef93e0f0ea6a78d508b7fbe
Related-Bug: #1455675
neutron/agent/linux/iptables_manager.py