Archive of the libbitcoin Slack #general channel.
wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version3/install.sh
This one works flawlessly.
The README at https://github.com/libbitcoin/libbitcoin-node/tree/version3 does not have that wget fetch. It has links to the correct install.sh though,I just didn´t see it right away.
What I did then, I cloned the repo with the link on the github-page
git clone https://github.com/libbitcoin/libbitcoin-node.git
which gave me a version that doesn´t build. It´s working now.iterator and the hashmap and the head , as well as simple modifications to several queries, the confirmation rate has increased to 5 per second, or roughly 5-10x faster than previously.$ CFLAGS="-03" CXXFLAGS="-03" ./install.sh --build-boost --enable-ndebug --disable-shared --prefix=<path>
Because all hash functions are written in C++, you will get obscenely poor performance if you do not let the compiler fully optimize. With this setting the optimized code outperforms C implementations.$ CFLAGS="-O3" CXXFLAGS="-O3" ./install.sh --build-boost --enable-ndebug --disable-shared --prefix=<path>--enable-sse4 is the most basic and should be available on any supported CPU.
--enable-avx2 and --enable-avx512 are also extremely common. I have been testing on a 7 year old machine that has sse4 and avx2 but not avx512. That allows 4 and and 8 lane vectorization, but not 16 lanes (avx512). If you set these then the build will enable them.
However, these are implemented such that portability is still enabled. This hurts performance, and so I have made a minor modification to one file locally...shani and neon (ARM) are not yet fully implemented.)inline bool have_avx512() NOEXCEPT
{
if constexpr (with_avx512)
return try_avx512();
else
return false;
}
inline bool have_avx2() NOEXCEPT
{
if constexpr (with_avx2)
return true;//// try_avx2();
else
return false;
}
inline bool have_sse41() NOEXCEPT
{
if constexpr (with_sse41)
return true;//// try_sse41();
else
return false;
} (edited)$ bn -c f:/bn.cfg --hardware Intrinsics... arm..... platform:0. intel... platform:1. avx512.. platform:0 compiled:0. avx2.... platform:1 compiled:1. sse41... platform:1 compiled:1. shani... platform:0 compiled:0. neon.... platform:0 compiled:0.
$ ./bn -c ../etc/libbitcoin/libbitcoin.conf -d Intrinsics... arm..... platform:0. intel... platform:1. avx512.. platform:0 compiled:0. avx2.... platform:1 compiled:0. sse41... platform:1 compiled:0. shani... platform:0 compiled:0. neon.... platform:0 compiled:0.
configure:3495: error: in `/home/user11/gitprojects2/libbitcoin4/build-libbitcoin-node/secp256k1': configure:3497: error: C compiler cannot create executables See `config.log' for more details(edited)
configure: WARNING: unrecognized options: --enable-avx2, --enable-sse4avx2 and ss4 optimization where not compiled:
$ ./bn -c ../libbitcoin.conf -d Intrinsics... arm..... platform:0. intel... platform:1. avx512.. platform:0 compiled:0. avx2.... platform:1 compiled:0. sse41... platform:1 compiled:0. shani... platform:0 compiled:0. neon.... platform:0 compiled:0.
libbitcoin-node$ git log
commit 0e7853934e778f7ba03e74b887b6a90c004596d1 (grafted, HEAD -> master, origin/master, origin/HEAD)
Author: Eric Voskuil <eric@voskuil.org>
Date: Wed Jun 12 21:02:09 2024 -0400
Merge pull request #643 from evoskuil/master
libbitcoin-system$ git log
commit b619ff2dd6c2e77679ce935cb84a177fbb7ae918 (grafted, HEAD -> master, origin/master, origin/HEAD)
Author: Eric Voskuil <eric@voskuil.org>
Date: Thu Jun 13 21:12:39 2024 -0400
Merge pull request #1480 from evoskuil/master
libbitcoin-network$ git log
commit 19177766c968917e3d38306e84f0d7c398d5c7e6 (grafted, HEAD -> master, origin/master, origin/HEAD)
Author: Eric Voskuil <eric@voskuil.org>
Date: Thu Jun 6 18:04:51 2024 -0400
Merge pull request #414 from evoskuil/master
libbitcoin-database$ git log
commit ed3e0a26b7072266d8b3b81134497ea9f575525b (grafted, HEAD -> master, origin/master, origin/HEAD)
Author: Eric Voskuil <eric@voskuil.org>
Date: Thu Jun 13 00:47:13 2024 -0400
Merge pull request #493 from evoskuil/master
checking whether C++ compiler accepts -mavx -mavx2... yes checking whether C++ compiler accepts -msse4.1... yes
CFLAGS="-O3" CXXFLAGS="-O3" ./install.sh --prefix=/home/tester/gitprojects2/libbitcoin4 --build-boost --enable-ndebug --disable-shared --enable-avx2 --enable-sse4$ ./bn -c ../etc/libbitcoin/libbitcoin.conf -d Intrinsics... arm..... platform:0. intel... platform:1. avx512.. platform:0 compiled:0. avx2.... platform:1 compiled:0. sse41... platform:1 compiled:0. shani... platform:0 compiled:0. neon.... platform:0 compiled:0.
configure:3495: error: in `/home/user11/gitprojects2/libbitcoin4/build-libbitcoin-node/secp256k1': configure:3497: error: C compiler cannot create executables See `config.log' for more details(edited)
spent_prevout(...) and unspendable_prevout(...) queries.unspendable_prevout reads, most of which is consumed by to_strong, which in turn is almost entirely spent in the tx hash table lookup. Since tx keys are 32 byte values, this is a (relatively) costly search. The tables is configured to 1.5 conflicts on average, but this can still cause significant paging of the body. The total actual distribution of conflict list lengths in the tx tables is:
tx: 1 frequency: 228206539 tx: 2 frequency: 171211514 tx: 3 frequency: 85657769 tx: 4 frequency: 32136386 tx: 5 frequency: 9642087 tx: 6 frequency: 2413019 tx: 7 frequency: 517115 tx: 8 frequency: 97139 tx: 9 frequency: 16368 tx: 10 frequency: 2436 tx: 11 frequency: 306 tx: 12 frequency: 31 tx: 13 frequency: 3
spent_prevout query, most of which is consumed by a search of the spend hash table for the 7 byte input point (composite key of 4 bytes for the tx pk and 3 for the input index). This is a much smaller key, but because the table correlates to inputs, it is much larger than the tx table and therefore results in a similar search cost. Spend conflicts are also 1.5 with the following real (observed) distribution:
spend: 0 frequency: 130555225 spend: 1 frequency: 860714907 spend: 2 frequency: 542083651 spend: 3 frequency: 167287129 spend: 4 frequency: 33528526 spend: 5 frequency: 4944542 spend: 6 frequency: 576384 spend: 7 frequency: 54768 spend: 8 frequency: 4321 spend: 9 frequency: 276 spend: 10 frequency: 18 spend: 11 frequency: 1
std::all_of(...) or via BOOST ASIO.
As std lib execution is only useful for simple loops, we use ASIO for network concurrency. I've learned in the past that the cost of using std lib execution policy can be very high. I tested it for simple two lane parallelization in RIPEMD and the result was horrific compared to just sequential execution. The only place we use it is in concurrency for scrypt hashing execution. In that case it provides a huge benefit with no ASIO complexities or dependency. The database queries are complex and costly, so I figured it was worth a look.
Turns out that using an ASIO thread pool, posting closures to the work queue, and tracking completion, absolutely crushes the much simpler loop vectorization. std lib takes 133 mins to ASIO's 79 mins.
I'm pretty sure that this type of performance difference would also impact C++20 co-routines. When I started on the network stack rewrite I looked at coroutines, but unlike the the rest of C++20, the reviews weren't good. A thread pool provide significant performance advantages, and these are now very visible.