JeremyRubin
commented at 8:01 PM on January 10, 2017:
contributor
This is a minor performance optimization of prevector. If the stored type is trivially destructible (such as unsigned char which is the main use of prevector), there is no need to call clear on the entries before freeing.
The call to clear seems to not get optimized out completely (likely because of the --_size; side-effect) with -O3.
std::is_trivially_copyable seems to enjoy full cross platform support.
On the included benchmark, I see about a 3% performance improvement.
theuni
commented at 8:42 PM on January 10, 2017:
member
any chance you get the same gain by specializing erase() with std::enable_if and std::is_trivially_destructible, simply reducing it down to a memset in the specialized case? That way we'd still get the zero'd mem, and it'd get sped up in several other places as well.
Add prevector destructor benchmarkaaa02e7f24
Only call clear on prevector if it isn't trivially destructible and don't loop in clear45a5aaf147
laanwj added the label Resource usage on Jan 11, 2017
JeremyRubin
commented at 6:47 PM on January 11, 2017:
contributor
@theuni I think that works -- may as well wrap both locations.
JeremyRubin force-pushed on Jan 11, 2017
kallewoof
commented at 12:08 AM on March 1, 2017:
member
utACK45a5aaf
dcousens
commented at 12:58 AM on March 1, 2017:
contributor
light utACK45a5aaf
laanwj
commented at 9:43 AM on March 14, 2017:
member
utACK45a5aaf
laanwj merged this on Mar 14, 2017
laanwj closed this on Mar 14, 2017
laanwj referenced this in commit 67ed40ed82 on Mar 14, 2017
PastaPastaPasta referenced this in commit 36c7a245b5 on Jan 2, 2019
PastaPastaPasta referenced this in commit 94ad776446 on Jan 2, 2019
PastaPastaPasta referenced this in commit e56c640bbb on Jan 2, 2019
PastaPastaPasta referenced this in commit 79288cf5f1 on Jan 3, 2019
PastaPastaPasta referenced this in commit 5cde7a2bf9 on Jan 21, 2019
PastaPastaPasta referenced this in commit 106023c8fe on Jan 29, 2019
PastaPastaPasta referenced this in commit dcd93006fc on Feb 26, 2019
PastaPastaPasta referenced this in commit ee6e5654e0 on Feb 26, 2019
UdjinM6 referenced this in commit b9ea7e8461 on Mar 9, 2019
PastaPastaPasta referenced this in commit 436575c9f4 on Mar 10, 2019
zkbot referenced this in commit aa225ebb0b on Jan 24, 2020
zkbot referenced this in commit 74ff73abab on Jan 24, 2020
Fuzzbawls referenced this in commit 8dfc4806f7 on May 19, 2020
furszy referenced this in commit 4ed15cc69d on Jun 8, 2020
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-04-15 21:16 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me