Closed gronke closed 5 years ago
A quick test on performance:
import iocage.decorators
@iocage.decorators.timeit
def test_popen():
import subprocess
subprocess.Popen(
["ifconfig", "em0"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
).communicate()
@iocage.decorators.timeit
def test_ioctl_helper():
import iocage.helpers_ioctl
iocage.helpers_ioctl.get_interface_ip4_address("em0")
def run(iterations):
print("----- subprocess.Popen -----")
[test_popen() for x in range(iterations)]
print("--- iocage.helpers_ioctl ---")
[test_ioctl_helper() for x in range(iterations)]
run(iterations=5)
$ python3.6 speedtest.py
----- subprocess.Popen -----
function [test_popen] finished in 24.06597137451172 ms
function [test_popen] finished in 25.435209274291992 ms
function [test_popen] finished in 27.526378631591797 ms
function [test_popen] finished in 24.75738525390625 ms
function [test_popen] finished in 24.570941925048828 ms
--- iocage.helpers_ioctl ---
function [test_ioctl_helper] finished in 5.7430267333984375 ms
function [test_ioctl_helper] finished in 0.04482269287109375 ms
function [test_ioctl_helper] finished in 0.032901763916015625 ms
function [test_ioctl_helper] finished in 0.019550323486328125 ms
function [test_ioctl_helper] finished in 0.028848648071289062 ms
When no MTU was specified explicitly, the MTU of the host bridge (defined in
interfaces
) is detected.python-iocage has implemented this feature in https://github.com/iocage/iocage/pull/722, but looks up the first bridge members MTU instead of the bridges value.