Package org.apache.cassandra.utils.obs

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


        int hashes = dis.readInt();
        int bitLength = dis.readInt();
        long[] bits = new long[bitLength];
        for (int i = 0; i < bitLength; i++)
            bits[i] = dis.readLong();
        OpenBitSet bs = new OpenBitSet(bits, bitLength);
        return new BloomFilter(hashes, bs);
    }
View Full Code Here


        return serializer_;
    }

    private static OpenBitSet bucketsFor(long numElements, int bucketsPer)
    {
        return new OpenBitSet(numElements * bucketsPer + EXCESS);
    }
View Full Code Here

    public BloomFilter deserialize(DataInput dis) throws IOException
    {
        int hashes = dis.readInt();
        long bitLength = dis.readInt();
        OpenBitSet bs = new OpenBitSet(bitLength << 6);
        int pageSize = bs.getPageSize();
        int pageCount = bs.getPageCount();

        for (int p = 0; p < pageCount; p++)
        {
            long[] bits = bs.getPage(p);
            for (int i = 0; i < pageSize && bitLength-- > 0; i++)
                bits[i] = dis.readLong();
        }

        return new BloomFilter(hashes, bs);
View Full Code Here

    }
   
    private static OpenBitSet bucketsFor(long numElements, int bucketsPer)
    {
        long numBits = numElements * bucketsPer + EXCESS; //TODO overflow?
        return new OpenBitSet((long)Math.min(Long.MAX_VALUE, numBits));
    }
View Full Code Here

    }

    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

        return serializer_;
    }

    private static OpenBitSet bucketsFor(long numElements, int bucketsPer)
    {
        return new OpenBitSet(numElements * bucketsPer + EXCESS);
    }
View Full Code Here

        return serializer_;
    }

    private static OpenBitSet bucketsFor(long numElements, int bucketsPer)
    {
        return new OpenBitSet(numElements * bucketsPer + EXCESS);
    }
View Full Code Here

        int hashes = dis.readInt();
        int bitLength = dis.readInt();
        long[] bits = new long[bitLength];
        for (int i = 0; i < bitLength; i++)
            bits[i] = dis.readLong();
        OpenBitSet bs = new OpenBitSet(bits, bitLength);
        return new BloomFilter(hashes, bs);
    }
View Full Code Here

    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++)
            compare(offbs, obs, i);
View Full Code Here

    public void timeit()
    {
        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

TOP

Related Classes of org.apache.cassandra.utils.obs.OpenBitSet

Copyright © 2018 www.massapicom. 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.