Пример #1
0
def test3():
    totalPushes = 0
    pushes = 0
    while (totalPushes < 1000000):
        for x in range(randint(1, 100)):
            heap.push(pq, (randint(0, 1000000), {
                "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
            #print y
    while (pushes > 0):
        y = heap.pop(pq)
        pushes -= 1
Пример #2
0
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)