public ScopeOnlySchemaRecordList(List<ScopeOnlySchemaRecord> records, HashAlgorithm algorithm) { for(ScopeOnlySchemaRecord record : records) { String id = null; String scopeOnly = record.getScope(); if(HashAlgorithm.MD5.equals(algorithm)) { id = DigestUtils.md5Hex(scopeOnly); } else { id = String.valueOf(LongHashFunction.xx().hashChars(scopeOnly)); } _idToSchemaRecordMap.put(id, record); } }
@Benchmark public void readXxh64(final Reader r, final Blackhole bh) { long result = 0; final Iterator<Entry<byte[], byte[]>> iterator = r.map.entryIterator(); while (iterator.hasNext()) { final Entry<byte[], byte[]> entry = iterator.next(); result += xx_r39().hashBytes(entry.getKey()); result += xx_r39().hashBytes(entry.getValue()); } bh.consume(result); }
static long getConfigurationId(final Collection<NodeId> identifiers, final Collection<Endpoint> endpoints) { long hash = 1; for (final NodeId id: identifiers) { hash = hash * 37 + HASH_FUNCTION.hashLong(id.getHigh()); hash = hash * 37 + HASH_FUNCTION.hashLong(id.getLow()); } for (final Endpoint endpoint : endpoints) { hash = hash * 37 + HASH_FUNCTION.hashChars(endpoint.getHostname()); hash = hash * 37 + HASH_FUNCTION.hashInt(endpoint.getPort()); } return hash; } }
private long hashByteBuffer(@NotNull ByteBuffer input, int off, int len) { if (input.hasArray()) { return unsafeHash(input.array(), BYTE_BASE + input.arrayOffset() + off, len); } else if (input instanceof DirectBuffer) { return unsafeHash(null, ((DirectBuffer) input).address() + off, len); } else { return hash(input, ByteBufferAccess.INSTANCE, off, len); } }
@Override public long longHash(String s, LongHashFunction hashFunction, int off, int len) { char[] value = (char[]) UnsafeAccess.UNSAFE.getObject(s, valueOffset); return hashFunction.hashChars(value, off, len); } }
long hash = HASH_FUNCTION_0.hashBytes(bytesToHash) & MASK; _buckets.add(new Bucket(entry.getKey(), hash, entry.getValue())); _hosts.add(entry.getKey()); int duplicate = pointsPerHost - 1; while (duplicate-- > 0) { hashOfHash = HASH_FUNCTION_0.hashLong(hashOfHash) & MASK; _buckets.add(new Bucket(entry.getKey(), hashOfHash, entry.getValue())); for (int i = 0; i < _numProbes; i++) _hashFunctions[i] = LongHashFunction.xx_r39(i);
AddressComparator(final int seed) { this.hashFunction = LongHashFunction.xx(seed); this.hashCache = new HashMap<>(); }
VirtualRowSnapshot vw = new VirtualRowSnapshot(data, schema); MinKRows mkRows = new MinKRows(numSamples); LongHashFunction hash = LongHashFunction.xx(this.seed); IRowIterator rowIt = data.getRowIterator(); int currRow = rowIt.getNextRow(); mkRows.push(hash.hashLong(vw.hashCode()), currRow); if (comp.compare(minRow, currRow) > 0) minRow = currRow;
@Benchmark public void readXxh64(final Reader r, final Blackhole bh) { long result = 0; bh.consume(r.c.seek(MDB_FIRST)); do { result += xx_r39().hashMemory(r.txn.key().addressOffset(), r.keySize); result += xx_r39().hashMemory(r.txn.val().addressOffset(), r.valSize); } while (r.c.seek(MDB_NEXT)); bh.consume(result); }
@Override default long hashCode64(int rowIndex, LongHashFunction hash) { assert !isMissing(rowIndex); return hash.hashLong(Double.doubleToRawLongBits(this.asDouble(rowIndex))); }
@Override default long hashCode64(int rowIndex, LongHashFunction hash) { assert !this.isMissing(rowIndex); return hash.hashInt(this.getInt(rowIndex)); }
private long unsafeHash(Object input, long off, long len) { return hash(input, UnsafeAccess.INSTANCE, off, len); }
@Override public long longHash(String s, LongHashFunction hashFunction, int off, int len) { char[] value = (char[]) UnsafeAccess.UNSAFE.getObject(s, valueOffset); int offset = UnsafeAccess.UNSAFE.getInt(s, offsetOffset); return hashFunction.hashChars(value, offset + off, len); } }
public void createBits(IColumn column, IMembershipSet memSet) { final IRowIterator myIter = memSet.getIterator(); LongHashFunction hash = LongHashFunction.xx(this.seed); int currRow = myIter.getNextRow(); int cardinality = 0; while ((currRow >= 0) && (cardinality < bitThreshold)) { // if threshold reached stop iterating if (!column.isMissing(currRow)) { long itemHash = column.hashCode64(currRow, hash); int index = (int) itemHash >>> (Long.SIZE - this.logSize); if (!bits.get(index)) cardinality++; this.bits.set(index); } currRow = myIter.getNextRow(); } }
@Benchmark public void readXxh64(final Reader r, final Blackhole bh) { long result = 0; bh.consume(r.c.first()); do { result += xx_r39().hashMemory(r.c.keyBuffer().addressOffset(), r.keySize); result += xx_r39().hashMemory(r.c.valBuffer().addressOffset(), r.valSize); } while (r.c.next()); bh.consume(result); }
@Override default long hashCode64(int rowIndex, LongHashFunction hash) { assert !isMissing(rowIndex); return hash.hashLong(Double.doubleToRawLongBits(this.getDouble(rowIndex))); }