Package com.facebook.util.digest

Examples of com.facebook.util.digest.LongMurmur3Hash


  public void testStress() throws Exception {
    // sanity test that exercises LongHashSet2 and LongLinkedList
    int inserts = 100000;
    int maxSize = 8000;
    SampledSet<Long> set = new SampledSetImpl<>(
      maxSize, new LongMurmur3Hash(), new LongHashSetFactory(maxSize)
    );
    timeAdds("custom-long-hash-set-2", set, inserts);
  }
View Full Code Here


  @BeforeMethod(alwaysRun = true)
  public void setUp() throws Exception {
    // needs to be a multiple of 4
    maxSetSize = 8;
    DigestFunction<Long> longMurmur3Hash = new LongMurmur3Hash();
    integerSet = new SampledSetImpl<Long>(
      maxSetSize, longMurmur3Hash, new IntegerHashSetFactory(maxSetSize)
    );
  }
View Full Code Here

  @Test(groups = "fast")
  public void testSanity() throws Exception {
    int largeMaxSetSize = 4000;
    IntegerHashSetFactory intHashSetFactory = new IntegerHashSetFactory(largeMaxSetSize);
    SampledSet<Long> largeSet =
      new SampledSetImpl<Long>(largeMaxSetSize, new LongMurmur3Hash(), intHashSetFactory);
    int numElements = 2000 * largeMaxSetSize;

    for (int i = 0; i < numElements; i++) {
      largeSet.add((long)i);
    }
View Full Code Here

  @Test(groups = "fast")
  public void testMerge() throws Exception {
    IntegerHashSetFactory longHashSetFactory = new IntegerHashSetFactory(maxSetSize);
    SampledSet<Long> otherSet =
      new SampledSetImpl<Long>(maxSetSize / 4, new LongMurmur3Hash(), longHashSetFactory);
    int firstSetSize = maxSetSize / 2;
   
    // populate the first set to its max size
    for (int i = 0; i < firstSetSize; i++) {
      integerSet.add((long)i);
View Full Code Here

  }
 
  @Test(groups = "fast")
  public void testMergeWithEmpty() throws Exception {
    IntegerHashSetFactory longHashSetFactory = new IntegerHashSetFactory(4);
    DigestFunction<Long> digestFunction = new LongMurmur3Hash();

    SampledSet<Long> set1 =
      new SampledSetImpl<Long>(4, digestFunction, longHashSetFactory);
    SampledSet<Long> set2 =
      new SampledSetImpl<Long>(4, digestFunction, longHashSetFactory);
View Full Code Here

  }

  @Test(groups = "fast")
  public void testProposedSize() throws Exception {
    SampledSet<Long> set1 =
      new SampledSetImpl<Long>(8, new LongMurmur3Hash(), new IntegerHashSetFactory());
    SampledSet<Long> set2 =
      new SampledSetImpl<Long>(8, new LongMurmur3Hash(), new IntegerHashSetFactory());
    SampledSet<Long> set3 =
      new SampledSetImpl<Long>(8, new LongMurmur3Hash(), new IntegerHashSetFactory());

    // set 1 will have 4 elements and sample rate of 1
    set1.add(0L);
    set1.add(1L);
    set1.add(2L);
View Full Code Here

public class TestLongMurmur3Hash {

  @Test(groups = "fast")
  public void testConsistency() throws Exception {
    LongMurmur3Hash longMurmur3Hash1 = new LongMurmur3Hash();
    LongMurmur3Hash longMurmur3Hash2 = new LongMurmur3Hash();

    for (long i = 0; i < 1000; i++) {
      Assert.assertEquals(
        longMurmur3Hash1.computeDigest(i),
        longMurmur3Hash2.computeDigest(i),
        String.format("Hashes don't match for %d", i)
      );
    }
  }
View Full Code Here

public class TestLongMurmur3Hash {

  @Test(groups = "fast")
  public void testConsistency() throws Exception {
    LongMurmur3Hash longMurmur3Hash1 = new LongMurmur3Hash();
    LongMurmur3Hash longMurmur3Hash2 = new LongMurmur3Hash();

    for (long i = 0; i < 1000; i++) {
      Assert.assertEquals(
        longMurmur3Hash1.computeDigest(i),
        longMurmur3Hash2.computeDigest(i),
        String.format("Hashes don't match for %d", i)
      );
    }
  }
View Full Code Here

  @BeforeMethod(alwaysRun = true)
  public void setUp() throws Exception {
    // needs to be a multiple of 4
    maxSetSize = 8;
    DigestFunction<Long> longMurmur3Hash = new LongMurmur3Hash();
    integerSet = new SampledSetImpl<Long>(
      maxSetSize, longMurmur3Hash, new IntegerHashSetFactory(maxSetSize)
    );
  }
View Full Code Here

  @Test(groups = "fast")
  public void testSanity() throws Exception {
    int largeMaxSetSize = 4000;
    IntegerHashSetFactory intHashSetFactory = new IntegerHashSetFactory(largeMaxSetSize);
    SampledSet<Long> largeSet =
      new SampledSetImpl<Long>(largeMaxSetSize, new LongMurmur3Hash(), intHashSetFactory);
    int numElements = 2000 * largeMaxSetSize;

    for (int i = 0; i < numElements; i++) {
      largeSet.add((long)i);
    }
View Full Code Here

TOP

Related Classes of com.facebook.util.digest.LongMurmur3Hash

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.