net: Replace cs_feeFilter with simple std::atomic#18819
net: Replace cs_feeFilter with simple std::atomic#18819fanquake merged 1 commit intobitcoin:masterfrom
Conversation
|
Not sure if we care about this case, but this adds a strict assumption that CAmount is a typedef of an primitive integer type. |
|
Yeah, I thought about making a simple setter/getter to not leak the std::atomic implementation detail from |
This assumption is already used: Lines 442 to 443 in e5b9308
EDIT: I've reconsidered this pull. |
promag
left a comment
There was a problem hiding this comment.
Light tested ACK fa321c4afe.
@hebasto I can't parse this sentence. Mind to explain? We already assume that the type is |
|
Unless a performance improvement can be demonstrated I'm not sure this change is really worth it. |
|
It is mostly about the removed code (11 lines), and cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention. |
|
Performance wise this should have no effect. Reading from the mempool is orders of magnitude slower than taking a lock on a recursive mutex (even with lock contention debugging enabled). |
@MarcoFalke Apologies for my confusing comment. |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
fa321c4 to
fa3c2c2
Compare
|
Rebased |
|
utACK fa3c2c2 All this stuff should move to |
fa3c2c2 to
fad1f0f
Compare
|
Rebased due to trivial conflict in adjacent line |
|
utACK fad1f0f |
|
cr ACK fad1f0f: patch looks correct |
fad1f0f net: Remove unused cs_feeFilter (MarcoFalke) Pull request description: A `RecursiveMutex` is overkill for setting or reading a plain integer. Even a `Mutex` is overkill, when a plain `std::atomic` can be used. This removes 11 lines of code. Also, it is cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention. ACKs for top commit: jnewbery: utACK fad1f0f practicalswift: cr ACK fad1f0f: patch looks correct Tree-SHA512: 647f9b954fbf52e138d3e710937eb9131b390fef0deae03fd6a162d5a18b9f194010800bbddc8f89208d91be2802dff11c3884d04b3dd233865abd12aa3cde06
A
RecursiveMutexis overkill for setting or reading a plain integer. Even aMutexis overkill, when a plainstd::atomiccan be used.This removes 11 lines of code. Also, it is cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention.