コード例 #1
0
    def test_one_million_writes(self):
        bf = BitBloomFilter(10 ** 6)
        t = time.time()

        for i in range(10 ** 6):
            bf.add(i)

        print('took {} seconds'.format(time.time() - t))
コード例 #2
0
    def test_one_million_writes_and_reads(self):
        bf = BitBloomFilter(10 ** 6)
        t = time.time()

        for i in range(10 ** 6):
            bf.add(i)

        for i in range(10 ** 6):
            if not bf.has(i):
                raise ValueError('missing {}'.format(repr(i)))

        print('took {} seconds'.format(time.time() - t))