I try to do a simple benchmark to compare the performance of a piece of python code running inside/outside intel sgx enclave. the code is quick simple (I got from online)
import time
from resource import getrusage, RUSAGE_SELF
def long_function():
for i in range(10 ** 10):
2 + 2
long_function()
print(getrusage(RUSAGE_SELF))
when I compare the result, I see the biggest difference is the voluntary context switches, 175 vs 1308422. What does that mean? I am using the Scone to wrap the code into a container to run inside enclave.
outside enclave
resource.struct_rusage(ru_utime=183.582198, ru_stime=0.20426, ru_maxrss=10916, ru_ixrss=0, ru_idrss=0, ru_isrss=0, ru_minflt=1109, ru_majflt=0, ru_nswap=0, ru_inblock=0, ru_oublock=0, ru_msgsnd=0, ru_msgrcv=0, ru_nsignals=0, ru_nvcsw=175, ru_nivcsw=3230)
inside enclave
resource.struct_rusage(ru_utime=183.267983, ru_stime=4.7623, ru_maxrss=37448, ru_ixrss=0, ru_idrss=0, ru_isrss=0, ru_minflt=2548, ru_majflt=0, ru_nswap=0, ru_inblock=0, ru_oublock=0, ru_msgsnd=0, ru_msgrcv=0, ru_nsignals=0, ru_nvcsw=1308422, ru_nivcsw=5835)