Prevector Quick Destruct #9505

pull JeremyRubin wants to merge 2 commits into bitcoin:master from JeremyRubin:prevector-quick-destruct changing 3 files +50 −6
  1. 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.

  2. 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.

  3. Add prevector destructor benchmark aaa02e7f24
  4. Only call clear on prevector if it isn't trivially destructible and don't loop in clear 45a5aaf147
  5. laanwj added the label Resource usage on Jan 11, 2017
  6. JeremyRubin commented at 6:47 PM on January 11, 2017: contributor

    @theuni I think that works -- may as well wrap both locations.

  7. JeremyRubin force-pushed on Jan 11, 2017
  8. kallewoof commented at 12:08 AM on March 1, 2017: member

    utACK 45a5aaf

  9. dcousens commented at 12:58 AM on March 1, 2017: contributor

    light utACK 45a5aaf

  10. laanwj commented at 9:43 AM on March 14, 2017: member

    utACK 45a5aaf

  11. laanwj merged this on Mar 14, 2017
  12. laanwj closed this on Mar 14, 2017

  13. laanwj referenced this in commit 67ed40ed82 on Mar 14, 2017
  14. JeremyRubin cross-referenced this on Feb 27, 2018 from issue Make prevector::resize() and other prevector operations much faster by eklitzke
  15. PastaPastaPasta referenced this in commit 36c7a245b5 on Jan 2, 2019
  16. PastaPastaPasta referenced this in commit 94ad776446 on Jan 2, 2019
  17. PastaPastaPasta referenced this in commit e56c640bbb on Jan 2, 2019
  18. PastaPastaPasta referenced this in commit 79288cf5f1 on Jan 3, 2019
  19. PastaPastaPasta referenced this in commit 5cde7a2bf9 on Jan 21, 2019
  20. PastaPastaPasta referenced this in commit 106023c8fe on Jan 29, 2019
  21. str4d cross-referenced this on Feb 22, 2019 from issue Micro-benchmarking framework part 1 by str4d
  22. PastaPastaPasta referenced this in commit dcd93006fc on Feb 26, 2019
  23. PastaPastaPasta referenced this in commit ee6e5654e0 on Feb 26, 2019
  24. UdjinM6 referenced this in commit b9ea7e8461 on Mar 9, 2019
  25. PastaPastaPasta referenced this in commit 436575c9f4 on Mar 10, 2019
  26. zkbot referenced this in commit aa225ebb0b on Jan 24, 2020
  27. zkbot referenced this in commit 74ff73abab on Jan 24, 2020
  28. random-zebra cross-referenced this on Apr 24, 2020 from issue [Core] Prevector by random-zebra
  29. Fuzzbawls referenced this in commit 8dfc4806f7 on May 19, 2020
  30. random-zebra cross-referenced this on May 27, 2020 from issue [Tests] Benchmarking Framework by random-zebra
  31. furszy referenced this in commit 4ed15cc69d on Jun 8, 2020
  32. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

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-05-20 06:55 UTC