You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are noticing regression with boost::hash when used with std::u16string in boost 1.81.0 version and compared to 1.78.0. As per the 1.81.0 documentation, it seems there are major changes in boost::hash and the performance with string should be improved. Any thoughts on this regression?
Sample program -
#include <boost/functional/hash.hpp>
#include <iostream>
#include <chrono>
int main()
{
// Start the timer
auto start = std::chrono::high_resolution_clock::now();
for(int i = 0; i < 10; i++)
{
boost::hash<std::u16string>()(u"hello");
}
// End the timer
auto end = std::chrono::high_resolution_clock::now();
// Calculate the duration
std::chrono::duration<double> duration = end - start;
// Print the duration in seconds
std::cout << "Execution time: " << (duration.count())/10 << " seconds." << std::endl;
return 0;
}
Which one is better is highly dependent on the specific CPU architecture. It looks like the latest x86 CPUs have a very fast multiplication, so the 1.78 implementation wins; but, if it's any consolation, the newer one is more theoretically sound and has better hash quality.
We are noticing regression with
boost::hash
when used withstd::u16string
in boost 1.81.0 version and compared to 1.78.0. As per the 1.81.0 documentation, it seems there are major changes inboost::hash
and the performance with string should be improved. Any thoughts on this regression?Sample program -
Link 1.78.0 - https://godbolt.org/z/ManWPoK8j
Link 1.81.0 - https://godbolt.org/z/hejbsfhc6
The text was updated successfully, but these errors were encountered: