Examples of OffHeapBitSet


Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

    }

    private static IFilter createFilter(int hash, long numElements, int bucketsPer, boolean offheap)
    {
        long numBits = (numElements * bucketsPer) + BITSET_EXCESS;
        IBitSet bitset = offheap ? new OffHeapBitSet(numBits) : new OpenBitSet(numBits);
        return new Murmur3BloomFilter(hash, bitset);
    }
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

    @Test
    public void testBitSetOperations()
    {
        long size_to_test = Integer.MAX_VALUE / 40;
        long size_and_excess = size_to_test + 20;
        OffHeapBitSet offbs = new OffHeapBitSet(size_and_excess);
        OpenBitSet obs = new OpenBitSet(size_and_excess);
        for (long i = 0; i < size_to_test; i++)
            populateRandom(offbs, obs, i);

        for (long i = 0; i < size_to_test; i++)
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

    {
        long size_to_test = Integer.MAX_VALUE / 10; // about 214 million
        long size_and_excess = size_to_test + 20;

        OpenBitSet obs = new OpenBitSet(size_and_excess);
        OffHeapBitSet offbs = new OffHeapBitSet(size_and_excess);
        logger.info("||Open BS set's|Open BS get's|Open BS clear's|Offheap BS set's|Offheap BS get's|Offheap BS clear's|");
        // System.out.println("||Open BS set's|Open BS get's|Open BS clear's|Offheap BS set's|Offheap BS get's|Offheap BS clear's|");
        loopOnce(obs, offbs, size_to_test);
    }
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

     * Test serialization and de-serialization in-memory
     */
    @Test
    public void testOffHeapSerialization() throws IOException
    {
        OffHeapBitSet bs = new OffHeapBitSet(100000);
        populateAndReserialize(bs);
    }
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

                bs.set(i);

        DataOutputBuffer out = new DataOutputBuffer();
        bs.serialize(out);
        DataInputStream in = new DataInputStream(new ByteArrayInputStream(out.getData()));
        OffHeapBitSet newbs = OffHeapBitSet.deserialize(in);
        compare(bs, newbs);
    }
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

    @Test
    public void testBitClear() throws IOException
    {
        int size = Integer.MAX_VALUE / 4000;
        OffHeapBitSet bitset = new OffHeapBitSet(size);
        List<Integer> randomBits = Lists.newArrayList();
        for (int i = 0; i < 10; i++)
            randomBits.add(random.nextInt(size));

        for (long randomBit : randomBits)
            bitset.set(randomBit);

        for (long randomBit : randomBits)
            Assert.assertEquals(true, bitset.get(randomBit));

        for (long randomBit : randomBits)
            bitset.clear(randomBit);

        for (long randomBit : randomBits)
            Assert.assertEquals(false, bitset.get(randomBit));
        bitset.close();
    }
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

     * Test serialization and de-serialization in-memory
     */
    @Test
    public void testOffHeapSerialization() throws IOException
    {
        OffHeapBitSet bs = new OffHeapBitSet(100000);
        populateAndReserialize(bs);
    }
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

                bs.set(i);

        DataOutputBuffer out = new DataOutputBuffer();
        bs.serialize(out);
        DataInputStream in = new DataInputStream(new ByteArrayInputStream(out.getData()));
        OffHeapBitSet newbs = OffHeapBitSet.deserialize(in);
        compare(bs, newbs);
    }
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

    @Test
    public void testBitClear() throws IOException
    {
        int size = Integer.MAX_VALUE / 4000;
        OffHeapBitSet bitset = new OffHeapBitSet(size);
        List<Integer> randomBits = Lists.newArrayList();
        for (int i = 0; i < 10; i++)
            randomBits.add(random.nextInt(size));

        for (long randomBit : randomBits)
            bitset.set(randomBit);

        for (long randomBit : randomBits)
            Assert.assertEquals(true, bitset.get(randomBit));

        for (long randomBit : randomBits)
            bitset.clear(randomBit);

        for (long randomBit : randomBits)
            Assert.assertEquals(false, bitset.get(randomBit));
        bitset.close();
    }
View Full Code Here

Examples of org.apache.cassandra.utils.obs.OffHeapBitSet

    }

    private static IFilter createFilter(int hash, long numElements, int bucketsPer, boolean offheap)
    {
        long numBits = (numElements * bucketsPer) + BITSET_EXCESS;
        IBitSet bitset = offheap ? new OffHeapBitSet(numBits) : new OpenBitSet(numBits);
        return new Murmur3BloomFilter(hash, bitset);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.