예제 #1
0
def test3():
    pq = heap.init()
    totalPushes=0
    pushes=0
    while(totalPushes<1000000):
        for x in range(randint(1,100)):
            heap.push(pq,(randint(0,10000),
                          {"rx" : "a",
                           "tx" : "b",
                           "txID" : 1,
                           "rxID" : 1,
                           "name" : "bob",         
                           "data": "none",
                          }))
            totalPushes+=1
            pushes+=1
        #for x in range(10000) :
        #    y=heap.peak(pq)
        
        for x in range(randint(1,100)):
            if (pushes):
                pushes-=1
                #y = heap.pop(pq)
            else:
                break
예제 #2
0
def test2():
    pq = heap.init()

    for x in range(1000000) :
        
        heap.push(pq,(randint(0,10000),
                      {"rx" : "a",
                       "tx" : "b",
                       "txID" : 1,
                       "rxID" : 1,
                       "name" : "bob",         
                       "data": "none",
                      }))
예제 #3
0
def test1():
    pq = heap.init()
    for x in range(1000000) :
        heap.push(pq,(x,
                      {"rx" : "a",
                       "tx" : "b",
                       "txID" : 1,
                       "rxID" : 1,
                       "name" : "bob",         
                       "data": "none",
                      }))
        #print x
    #for x in range(1000000) :
    #    y=heap.peak(pq)
    
    for x in range(1000000):
        #y = heap.pop(pq)
        #print y[0] #print y
        #print "\n"
        pass
예제 #4
0
import heap
from random import randint
import sys
import timeit

REPEATS = 10
NUMBER = 10

# push in increasing
pq = heap.init(None)


def test1():
    for x in range(1000000):
        heap.push(pq, (x, {
            "rx": "a",
            "tx": "b",
            "txID": 1,
            "rxID": 1,
            "name": "bob",
            "data": "none",
        }))

    #for x in range(1000000) :
    #    y=heap.peak(pq)

    for x in range(1000000):
        y = heap.pop(pq)
        #print y
        #print "\n"
예제 #5
0
파일: test_heap.py 프로젝트: annonch/simian
import heap
from random import randint
import sys
import timeit

REPEATS = 10
NUMBER = 10

# push in increasing
pq = heap.init()


def test1():
    for x in range(1000000):
        heap.push(pq, (x, {
            "rx": "a",
            "tx": "b",
            "txID": 1,
            "rxID": 1,
            "name": "bob",
            "data": "none",
        }))

    #for x in range(1000000) :
    #    y=heap.peak(pq)

    for x in range(1000000):
        y = heap.pop(pq)
        #print y
        #print "\n"