Hi Everyone,
It looks like Crypto++ is achieving 3.0 cpb for BLAKE2b and 4.2 cpb for
BLAKE2s. On a SSE4 machine running at 2.4 GHz, that corresponds to 754
MiB/s for BLAKE2b and 549 MiB/s for BLAKE2s. The numbers are consistent
with the reference implementation and it looks like it is achieving
theoretical maximums.
The high rates are due to (1) the excellent SSE2/SSE4 reference
implementation, and (2) GCC and -O3. If we test at -O2, then performance
drops considerably. If we move to Clang, then performance drops slightly by
about 1.0 cpb.
-----
To duplicate the results:
export CXXFLAGS="-DNDEBUG -g2 -O3"
make clean && make
make bench
After the benchmarks are made, navigate to benchmark.html on the filesystem.
-----
Clang is not as aggressive with optimizations; and it shoots itself in the
foot with its handling of "logical" constants and constexpr in C++. For
example, when we have "const int X=1", then Clang will not treat it as a
constexpr and sometimes fail to propagate the constant even though X will
not change under the laws of the universe as we currently understand them.
I tried to ensure every value presented to Clang was a constexpr, if
possible. That's why we have things like the following, which don't
normally appear in the crypto++ sources. Its ugly, but it promotes faster
code.
template <bool T_64bit>
struct CRYPTOPP_NO_VTABLE BLAKE2_Info : public
VariableKeyLength<0,0,(T_64bit ? 64 :
32),1,SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
{
typedef VariableKeyLength<0,0,(T_64bit ? 64 :
32),1,SimpleKeyingInterface::NOT_RESYNCHRONIZABLE> KeyBase;
CRYPTOPP_CONSTANT(MIN_KEYLENGTH = KeyBase::MIN_KEYLENGTH);
CRYPTOPP_CONSTANT(MAX_KEYLENGTH = KeyBase::MAX_KEYLENGTH);
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH = KeyBase::DEFAULT_KEYLENGTH);
CRYPTOPP_CONSTANT(BLOCKSIZE = (T_64bit ? 128 : 64))
CRYPTOPP_CONSTANT(DIGESTSIZE = (T_64bit ? 64 : 32))
CRYPTOPP_CONSTANT(SALTSIZE = (T_64bit ? 16 : 8))
CRYPTOPP_CONSTANT(PERSONALIZATIONSIZE = (T_64bit ? 16 : 8))
CRYPTOPP_CONSTANT(ALIGNSIZE = BLAKE2_DALIGN);
};
-----
Jeff
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.