Am 11.05.2011 18:27, schrieb Andi Vajda:
> Does it crash as easily with Python 2.6 ?
> If not, then that could be an answer as to why this wasn't noticed before.

With 20 test samples, it seems like Python 2.6 survives 50% longer than
Python 2.7.

python2.6
0, 1.089
1, 2.688
2, 1.066
3, 6.416
4, 0.921
5, 1.859
6, 0.896
7, 0.910
8, 1.851
9, 1.042
10, 1.110
11, 1.040
12, 1.072
13, 1.825
14, 3.720
15, 1.822
16, 0.983
17, 1.931
18, 0.998
19, 1.105
cnt: 20, min: 0.896, max: 6.416, avg: 1.717

python2.7
0, 1.795
1, 0.953
2, 1.802
3, 1.022
4, 0.906
5, 1.841
6, 1.080
7, 0.958
8, 1.110
9, 0.924
10, 0.894
11, 1.958
12, 0.898
13, 1.846
14, 0.936
15, 1.859
16, 1.036
17, 1.092
18, 0.920
19, 0.949
cnt: 20, min: 0.894, max: 1.958, avg: 1.239
import subprocess
from time import time
log = open("log.txt", "w")
cnt = 100

for py in ("python2.6", "python2.7"):
    log.write(py + "\n")
    dur = []
    for i in range(cnt):
        start = time()
        subprocess.call(["python2.6", "cyclic.py"])
        run = time() - start
        dur.append(run)
        log.write("%i, %0.3f\n" % (i, run))
        print i
    log.write("cnt: %i, min: %0.3f, max: %0.3f, avg: %0.3f\n\n" % 
              (cnt, min(dur), max(dur), sum(dur) / cnt)) 

    

import lucene
import threading
import time
import gc

lucene.initVM()

def alloc():
    while 1:
        a = {}, {}, {}, {}, {}, {}
        time.sleep(0.011)

t = threading.Thread(target=alloc)
t.daemon = True

t.start()

while 1:
    obj = {}
    # create cycle
    obj["obj"] = obj
    obj["jcc"] = lucene.JArray('object')(1, lucene.File)
    time.sleep(0.001)

Reply via email to