Hi,

I maked new benchmark:

import random,string, time

t=time.time()

def random_string(dl=10):
    d = [random.choice(string.letters) for x in xrange(dl)]
    s = "".join(d)
    return s

basic=[]
words=[]
n=20000   #number of basic words
n2=5000  #number of words in text

#Create list of words variants
for i in range(n):
    basic_word=random_string()
    if basic_word in basic:
        basic_word=random_string()
    basic.append(basic_word)
    tmp=[]
    tmp.append(basic_word)
    for j in range(4):
        tmp.append(basic_word+random_string(3))
    words.append(tmp)

#Create random text
text=[]
for i in range(n2):
    r1=random.randint(0,n-1)
    r2=random.randint(0,3)
    text.append(words[r1][r2])

#Replace non basic word to basic word
for i in range(n2):
    for j in range(n):
        if text[i] in words[j]:
            text[i]=words[j][0]

ok=0
for i in range(n2):
    if text[i] in basic:
        ok+=1

if ok==n2:
    print("OK")
else:
    print("Fail")
print(time.time()-t)

This code tranform non basic word to basic word. For simply I use random strings.

I tested this code on Linux and CPython use 7.8 MB RAM, but Pypy use 14.5 MB RAM.

Grzegorz


_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to