Example #1
0
    for index, runtime in enumerate(runtimes):
        print '%25s\t%10d\t\t%14.3f ms' % ('trie:findWordCount', 2**(index+2), runtime)
        trieFindWordCountFile.write('%10d\t%14.3f\n' % (2**(index+2), runtime))

    runtimes = []
    for i in range(2,17):
        runtime = addWordsToEmptyList(punamusta, 2**i, repeats, '%25s\t%10d\t' % ('punamusta:addToEmpty', 2**i), False)
        print '%25s\t%10d\t\t%14.3f ms' % ('punamusta:addToEmpty', 2**i, runtime)
        punamustaAddFile.write('%10d\t%8.3f\n' % (2**i, runtime))
        runtimes.append(findWords(punamusta, words[7], repeats, printout=False))
    for index, runtime in enumerate(runtimes):
        print '%25s\t%10d\t%8.3f ms' % ('punamusta:findWordCount', 2**(index+2), runtime)
        punamustaFindWordCountFile.write('%10d\t%14.3f\n' % (2**(index+2), runtime))

    print 'Adding all words to Punamusta'
    punamusta.addFromReader()
    print 'Adding all words to Trie'
    trie.addFromReader()


    for i in range(4,10+1):
        runtime = findWords(trie, words[i], repeats, printout=False)
        print '%25s\t%10d\t\t%14.3f ms' % ('trie:findWordLength', i, runtime)
        trieFindLengthFile.write('%10d\t%14.3f\n' % (i, runtime))
    for i in range(4,10+1):
        runtime = findWords(punamusta, words[i], repeats, printout=False)
        print '%25s\t%10d\t\t%14.3f ms' % ('punamusta:findWordLength', i, runtime)
        punamustaFindLengthFile.write('%10d\t%14.3f\n' % (i, runtime))