Page MenuHomePhabricator

D7996.diff
No OneTemporary

D7996.diff

diff --git a/doc/release-notes.md b/doc/release-notes.md
--- a/doc/release-notes.md
+++ b/doc/release-notes.md
@@ -21,6 +21,12 @@
- The `-debug=db` logging category, which was deprecated in 0.22.4 and replaced by
`-debug=walletdb` to distinguish it from `coindb`, has been removed.
+- Users setting custom `dbcache` values can increase their setting slightly
+ without using any more real memory. Recent changes reduced the memory use
+ by about 9% and made chainstate accounting more accurate (it was underestimating
+ the use of memory before). For example, if you set a value of "450" before, you
+ may now set a value of "500" to use about the same real amount of memory. (#16957)
+
P2P and network changes
-----------------------
diff --git a/src/coins.h b/src/coins.h
--- a/src/coins.h
+++ b/src/coins.h
@@ -84,8 +84,17 @@
* Note: This information above might be outdated as the unordered map
* container type has meanwhile been switched to the C++ standard library
* implementation.
+ *
+ * Having the hash noexcept allows libstdc++'s unordered_map to recalculate
+ * the hash during rehash, so it does not have to cache the value. This
+ * reduces node's memory by sizeof(size_t). The required recalculation has
+ * a slight performance penalty (around 1.6%), but this is compensated by
+ * memory savings of about 9% which allow for a larger dbcache setting.
+ *
+ * @see
+ * https://gcc.gnu.org/onlinedocs/gcc-9.2.0/libstdc++/manual/manual/unordered_associative.html
*/
- size_t operator()(const COutPoint &outpoint) const {
+ size_t operator()(const COutPoint &outpoint) const noexcept {
return SipHashUint256Extra(k0, k1, outpoint.GetTxId(), outpoint.GetN());
}
};

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 11:11 (15 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187534
Default Alt Text
D7996.diff (1 KB)

Event Timeline