There is a performance issue when using a system call after pre-allocating big amount of memory (e.g. numpy array). The issue grows with the amount of memory.
test.py :
import os
import sys
import time
import numpy
start = time.clock()
test = int(sys.argv[1])
a = numpy.zeros((test,500,500))
for i in range(test) :
os.system("echo true > /dev/null")
elapsed = (time.clock() - start)
print(elapsed)
The per-iteration time increases dramatically :
edouard@thorin:~/now3/code$ python test.py 100
0.64
edouard@thorin:~/now3/code$ python test.py 200
2.09
edouard@thorin:~/now3/code$ python test.py 400
14.26
This should not be related to virtual memory. Is it a known issue?