mulxp_hash | String hash functions
kandi X-RAY | mulxp_hash Summary
kandi X-RAY | mulxp_hash Summary
mulxp_hash is a C++ library. mulxp_hash has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.
Candidate replacements for use with boost::unordered_flat_map from Boost 1.81, instead of the default boost::hash. Might be added as a dedicated boost::string_hash function object for string hashing only, or directly as the implementation underneath boost::hash et al. As a basic primitive, the functions use mulx, a multiplication of two 64 bit numbers yielding a 128 bit result, then combining its two 64 parts with bitwise-xor. mulx has very good combiner properties for its cost (a single mul instruction under x86), and has been popularized by Vladimir Makarov as the basis of his hash function MUM hash. mulxp0_hash is closest to boost::hash from Boost 1.81, and uses the same basic state = combine( state, input ); round, with combine(h, v) being h ^ mulx( h + 1 + v, k ), where k is a constant. Unlike boost::hash, it adds a leading round of scrambling the initial seed, and a trailing round of scrambling the final result. (These are necessary to pass the SMHasher battery of tests.). Since this construction makes the next round dependent on the current one, the loop is latency-bound. The mul instruction has higher throughput than latency, which can be exploited by changing the round to state = combine( state, mix( input ) );, with the combine function cheaper than the mix one, a construct popularized by Austin Appleby's MurmurHash. mulxp1_hash follows this approach, with a round of h ^= mulx( v1 + w, k );, where k is, as before, a constant, and w is a Weyl sequence (a fancy way of saying that w is updated on each iteration by adding a constant to it, w += q;.). On sufficiently long inputs, where the parts outside the loop don't matter, mulxp1_hash is about 2.5 times as fast as mulxp0_hash. (However, long inputs don't really matter for our primary target use case, a hash function for boost::unordered_flat_map, as most keys are small.). mulxp2_hash is a slight variation of mulxp1_hash, using the same round, which basically unrolls the main loop twice, consuming 16 bytes at a time. This makes it slightly (10%) faster on long inputs, but slower on short inputs. The final member of the mulxp family is mulxp3_hash. It has been inspired by the UMAC/NH family of functions started by FARSH, continued with MUM and perfected with wyhash. These consume 16 bytes (two words) of input at a time, v1 and v2, and feed both to the mulx primitive, as in mulx(v1 + k1, v2 + k2), where k1 and k2 are suitably chosen constants that ideally would come from a secret one-time pad. The advantage of this scheme is that the inner loop performs one fewer multiplication per round, which ideally would double the speed. The disadvantage is that if one of the operands to the mulx primitive happens to be zero, the other input word is essentially discarded and does not affect the final hash value. In mulxp3_hash, the round operation is h ^= mulx( v1 + w, v2 + w + k );, where w is a Weyl sequence as above, and k is a constant. This makes mulxp3_hash approximately 1.5 times as fast as mulxp2_hash.
Candidate replacements for use with boost::unordered_flat_map from Boost 1.81, instead of the default boost::hash. Might be added as a dedicated boost::string_hash function object for string hashing only, or directly as the implementation underneath boost::hash et al. As a basic primitive, the functions use mulx, a multiplication of two 64 bit numbers yielding a 128 bit result, then combining its two 64 parts with bitwise-xor. mulx has very good combiner properties for its cost (a single mul instruction under x86), and has been popularized by Vladimir Makarov as the basis of his hash function MUM hash. mulxp0_hash is closest to boost::hash from Boost 1.81, and uses the same basic state = combine( state, input ); round, with combine(h, v) being h ^ mulx( h + 1 + v, k ), where k is a constant. Unlike boost::hash, it adds a leading round of scrambling the initial seed, and a trailing round of scrambling the final result. (These are necessary to pass the SMHasher battery of tests.). Since this construction makes the next round dependent on the current one, the loop is latency-bound. The mul instruction has higher throughput than latency, which can be exploited by changing the round to state = combine( state, mix( input ) );, with the combine function cheaper than the mix one, a construct popularized by Austin Appleby's MurmurHash. mulxp1_hash follows this approach, with a round of h ^= mulx( v1 + w, k );, where k is, as before, a constant, and w is a Weyl sequence (a fancy way of saying that w is updated on each iteration by adding a constant to it, w += q;.). On sufficiently long inputs, where the parts outside the loop don't matter, mulxp1_hash is about 2.5 times as fast as mulxp0_hash. (However, long inputs don't really matter for our primary target use case, a hash function for boost::unordered_flat_map, as most keys are small.). mulxp2_hash is a slight variation of mulxp1_hash, using the same round, which basically unrolls the main loop twice, consuming 16 bytes at a time. This makes it slightly (10%) faster on long inputs, but slower on short inputs. The final member of the mulxp family is mulxp3_hash. It has been inspired by the UMAC/NH family of functions started by FARSH, continued with MUM and perfected with wyhash. These consume 16 bytes (two words) of input at a time, v1 and v2, and feed both to the mulx primitive, as in mulx(v1 + k1, v2 + k2), where k1 and k2 are suitably chosen constants that ideally would come from a secret one-time pad. The advantage of this scheme is that the inner loop performs one fewer multiplication per round, which ideally would double the speed. The disadvantage is that if one of the operands to the mulx primitive happens to be zero, the other input word is essentially discarded and does not affect the final hash value. In mulxp3_hash, the round operation is h ^= mulx( v1 + w, v2 + w + k );, where w is a Weyl sequence as above, and k is a constant. This makes mulxp3_hash approximately 1.5 times as fast as mulxp2_hash.
Support
Quality
Security
License
Reuse
Support
mulxp_hash has a low active ecosystem.
It has 4 star(s) with 0 fork(s). There are 1 watchers for this library.
It had no major release in the last 6 months.
mulxp_hash has no issues reported. There are no pull requests.
It has a neutral sentiment in the developer community.
The latest version of mulxp_hash is current.
Quality
mulxp_hash has no bugs reported.
Security
mulxp_hash has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
License
mulxp_hash is licensed under the BSL-1.0 License. This license is Permissive.
Permissive licenses have the least restrictions, and you can use them in most projects.
Reuse
mulxp_hash releases are not available. You will need to build from source code and install.
Installation instructions are not available. Examples and code snippets are available.
Top functions reviewed by kandi - BETA
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mulxp_hash
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mulxp_hash
mulxp_hash Key Features
No Key Features are available at this moment for mulxp_hash.
mulxp_hash Examples and Code Snippets
No Code Snippets are available at this moment for mulxp_hash.
Community Discussions
No Community Discussions are available at this moment for mulxp_hash.Refer to stack overflow page for discussions.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mulxp_hash
You can download it from GitHub.
Support
For any new features, suggestions and bugs create an issue on GitHub.
If you have any questions check and ask questions on community page Stack Overflow .
Find more information at:
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page