Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ if test "$enable_debug" = "yes"; then
AX_CHECK_PREPROC_FLAG([-DABORT_ON_FAILED_ASSUME], [DEBUG_CPPFLAGS="$DEBUG_CPPFLAGS -DABORT_ON_FAILED_ASSUME"], [], [$CXXFLAG_WERROR])
AX_CHECK_COMPILE_FLAG([-ftrapv], [DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -ftrapv"], [], [$CXXFLAG_WERROR])
else
dnl If not debugging, enable more aggressive optimizations for sphlib sources
AX_CHECK_COMPILE_FLAG([-O3], [SPHLIB_CFLAGS="$SPHLIB_CFLAGS -O3"], [], [$CXXFLAG_WERROR])

# We always enable at at least -g1 debug info to support proper stacktraces in crash infos
# Stacktraces will be suboptimal due to optimization, but better than nothing. Also, -fno-omit-frame-pointer
# mitigates this a little bit
Expand Down Expand Up @@ -1874,6 +1877,7 @@ AC_SUBST(PIC_FLAGS)
AC_SUBST(PIE_FLAGS)
AC_SUBST(SANITIZER_CXXFLAGS)
AC_SUBST(SANITIZER_LDFLAGS)
AC_SUBST(SPHLIB_CFLAGS)
AC_SUBST(SSE42_CXXFLAGS)
AC_SUBST(SSE41_CXXFLAGS)
AC_SUBST(CLMUL_CXXFLAGS)
Expand Down
16 changes: 13 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ LIBBITCOIN_WALLET_TOOL=libbitcoin_wallet_tool.a
endif

LIBBITCOIN_CRYPTO = $(LIBBITCOIN_CRYPTO_BASE)
LIBBITCOIN_CRYPTO_SPH = crypto/libbitcoin_crypto_sph.la
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SPH)
if ENABLE_SSE41
LIBBITCOIN_CRYPTO_SSE41 = crypto/libbitcoin_crypto_sse41.la
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE41)
Expand Down Expand Up @@ -718,8 +720,16 @@ crypto_libbitcoin_crypto_avx2_la_CXXFLAGS += $(AVX2_CXXFLAGS)
crypto_libbitcoin_crypto_avx2_la_CPPFLAGS += -DENABLE_AVX2
crypto_libbitcoin_crypto_avx2_la_SOURCES = crypto/sha256_avx2.cpp

# x11
crypto_libbitcoin_crypto_base_la_SOURCES += \
# See explanation for -static in crypto_libbitcoin_crypto_base_la's LDFLAGS and
# CXXFLAGS above
crypto_libbitcoin_crypto_sph_la_LDFLAGS = $(AM_LDFLAGS) -static
crypto_libbitcoin_crypto_sph_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) -static
crypto_libbitcoin_crypto_sph_la_CPPFLAGS = $(AM_CPPFLAGS)
crypto_libbitcoin_crypto_sph_la_CFLAGS = $(SPHLIB_CFLAGS)
crypto_libbitcoin_crypto_sph_la_CPPFLAGS += \
-DSPH_SMALL_FOOTPRINT_CUBEHASH=1 \
-DSPH_SMALL_FOOTPRINT_JH=1
crypto_libbitcoin_crypto_sph_la_SOURCES = \
crypto/x11/aes_helper.c \
crypto/x11/blake.c \
crypto/x11/bmw.c \
Expand Down Expand Up @@ -1009,7 +1019,7 @@ endif
# dashconsensus library #
if BUILD_BITCOIN_LIBS
include_HEADERS = script/bitcoinconsensus.h
libdashconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_base_la_SOURCES) $(libbitcoin_consensus_a_SOURCES)
libdashconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_base_la_SOURCES) $(crypto_libbitcoin_crypto_sph_la_SOURCES) $(libbitcoin_consensus_a_SOURCES)

libdashconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
libdashconsensus_la_LIBADD = $(LIBDASHBLS) $(LIBSECP256K1) $(GMP_LIBS)
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.bench.include
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ bench_bench_dash_SOURCES = \
bench/nanobench.cpp \
bench/peer_eviction.cpp \
bench/pool.cpp \
bench/pow_hash.cpp \
bench/rpc_blockchain.cpp \
bench/rpc_mempool.cpp \
bench/strencodings.cpp \
Expand Down
72 changes: 0 additions & 72 deletions src/bench/crypto_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,6 @@ static void DSHA256_1M(benchmark::Bench& bench)
});
}

static void X11_1M(benchmark::Bench& bench)
{
uint256 hash;
std::vector<uint8_t> in(BUFFER_SIZE,0);
bench.batch(in.size()).unit("byte").run([&] {
hash = HashX11(in.begin(), in.end());
});
}

/* Hash different number of bytes via DSHA256 */
static void DSHA256_0032b_single(benchmark::Bench& bench)
{
Expand Down Expand Up @@ -359,74 +350,11 @@ static void DSHA256_2048b_single(benchmark::Bench& bench)
});
}

/* Hash different number of bytes via X11 */
static void X11_0032b_single(benchmark::Bench& bench)
{
uint256 hash;
std::vector<uint8_t> in(32,0);
bench.batch(in.size()).unit("byte").run([&] {
hash = HashX11(in.begin(), in.end());
});
}

static void X11_0080b_single(benchmark::Bench& bench)
{
uint256 hash;
std::vector<uint8_t> in(80,0);
bench.batch(in.size()).unit("byte").run([&] {
hash = HashX11(in.begin(), in.end());
});
}

static void X11_0128b_single(benchmark::Bench& bench)
{
uint256 hash;
std::vector<uint8_t> in(128,0);
bench.batch(in.size()).unit("byte").run([&] {
hash = HashX11(in.begin(), in.end());
});
}

static void X11_0512b_single(benchmark::Bench& bench)
{
uint256 hash;
std::vector<uint8_t> in(512,0);
bench.batch(in.size()).unit("byte").run([&] {
hash = HashX11(in.begin(), in.end());
});
}

static void X11_1024b_single(benchmark::Bench& bench)
{
uint256 hash;
std::vector<uint8_t> in(1024,0);
bench.batch(in.size()).unit("byte").run([&] {
hash = HashX11(in.begin(), in.end());
});
}

static void X11_2048b_single(benchmark::Bench& bench)
{
uint256 hash;
std::vector<uint8_t> in(2048,0);
bench.batch(in.size()).unit("byte").run([&] {
hash = HashX11(in.begin(), in.end());
});
}

BENCHMARK(DSHA256_1M);
BENCHMARK(X11_1M);

BENCHMARK(DSHA256_0032b_single);
BENCHMARK(DSHA256_0080b_single);
BENCHMARK(DSHA256_0128b_single);
BENCHMARK(DSHA256_0512b_single);
BENCHMARK(DSHA256_1024b_single);
BENCHMARK(DSHA256_2048b_single);

BENCHMARK(X11_0032b_single);
BENCHMARK(X11_0080b_single);
BENCHMARK(X11_0128b_single);
BENCHMARK(X11_0512b_single);
BENCHMARK(X11_1024b_single);
BENCHMARK(X11_2048b_single);
Loading
Loading