This is a sub-item of #95.
In a profiling iocage list run I made of 0.795 seconds, 0.204 seconds were spent in zfs.py's run function, which is just a subprocess wrapper to call zfs(8) or zpool(8):
|
def run(command, **kwargs): |
|
kwargs.setdefault('stdout', subprocess.PIPE) |
|
kwargs.setdefault('stderr', subprocess.PIPE) |
|
kwargs.setdefault('encoding', 'utf8') |
|
check = kwargs.pop('check', True) |
|
proc = subprocess.Popen(command, **kwargs) |
|
stdout, stderr = proc.communicate() |
|
cp = subprocess.CompletedProcess( |
|
command, proc.returncode, stdout=stdout, stderr=stderr |
|
) |
|
if check: |
|
try: |
|
cp.check_returncode() |
|
except subprocess.CalledProcessError: |
|
raise ZFSException(cp.returncode, cp.stderr) |
|
return cp |
We could reduce this time by using libzfs, avoiding the process creation and communication overhead.
This is a sub-item of #95.
In a profiling
iocage listrun I made of 0.795 seconds, 0.204 seconds were spent inzfs.py'srunfunction, which is just a subprocess wrapper to callzfs(8)orzpool(8):iocage/iocage_lib/zfs.py
Lines 8 to 23 in 6518661
We could reduce this time by using
libzfs, avoiding the process creation and communication overhead.