From 79e4366d06ad651b616bbca9ba7a534164aaf5e9 Mon Sep 17 00:00:00 2001 From: SimonMaracine Date: Sat, 27 Apr 2024 16:10:51 +0300 Subject: [PATCH] Increment version and clean up some things --- README.md | 2 +- src/cpp_shared_ref/memory.hpp | 4 +- src/cpp_shared_ref/version.hpp | 2 +- tests/perf/memory/saved/massif_shared_ptr.txt | 65 ------------------ tests/perf/memory/saved/massif_shared_ref.txt | 60 ---------------- .../memory/saved/massif_shared_ref_old.txt | 68 ------------------- tests/perf/speed/saved/asus_shared_ptr.txt | 1 - tests/perf/speed/saved/asus_shared_ref.txt | 1 - tests/perf/speed/saved/lenovo_shared_ptr.txt | 1 - tests/perf/speed/saved/lenovo_shared_ref.txt | 1 - 10 files changed, 3 insertions(+), 202 deletions(-) delete mode 100644 tests/perf/memory/saved/massif_shared_ptr.txt delete mode 100644 tests/perf/memory/saved/massif_shared_ref.txt delete mode 100644 tests/perf/memory/saved/massif_shared_ref_old.txt delete mode 100644 tests/perf/speed/saved/asus_shared_ptr.txt delete mode 100644 tests/perf/speed/saved/asus_shared_ref.txt delete mode 100644 tests/perf/speed/saved/lenovo_shared_ptr.txt delete mode 100644 tests/perf/speed/saved/lenovo_shared_ref.txt diff --git a/README.md b/README.md index 5d1ec6e..29acef0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ that the reference increments and decrements are not atomic. The premise is that can be very useful in contexts outside of multithreading, in which atomicity is not needed, being just useless overhead. This is why I tried making my own version of `std::shared_ptr`. -Right now, `shared_ref` doesn't fully conform with the `std::shared_ptr` specification of `C++17`. This is probably +Right now, `shared_ref` doesn't fully conform to the `std::shared_ptr` specification of `C++17`. This is probably an incomplete list of missing features from my version: - Not allocator-aware diff --git a/src/cpp_shared_ref/memory.hpp b/src/cpp_shared_ref/memory.hpp index 9980d94..647c0a2 100644 --- a/src/cpp_shared_ref/memory.hpp +++ b/src/cpp_shared_ref/memory.hpp @@ -16,7 +16,7 @@ namespace sm { bad_weak_ref(const bad_weak_ref&) noexcept = default; const char* what() const noexcept override { - return "Shared pointer construction failed, as weak pointer is empty"; + return "Shared pointer construction failed, as weak pointer manages no object"; } }; } @@ -74,7 +74,6 @@ namespace sm { ptr = ref.ptr; block = ref.block; - // We just created a new strong reference block.base->strong_count++; } @@ -634,7 +633,6 @@ namespace sm { ref.ptr = ptr; ref.block = block; - // We just created a new strong reference block.base->strong_count++; } diff --git a/src/cpp_shared_ref/version.hpp b/src/cpp_shared_ref/version.hpp index c295861..8f65b34 100644 --- a/src/cpp_shared_ref/version.hpp +++ b/src/cpp_shared_ref/version.hpp @@ -2,6 +2,6 @@ namespace sm { inline constexpr unsigned int VERSION_MAJOR {0u}; - inline constexpr unsigned int VERSION_MINOR {2u}; + inline constexpr unsigned int VERSION_MINOR {3u}; inline constexpr unsigned int VERSION_PATCH {0u}; } diff --git a/tests/perf/memory/saved/massif_shared_ptr.txt b/tests/perf/memory/saved/massif_shared_ptr.txt deleted file mode 100644 index 3d448d1..0000000 --- a/tests/perf/memory/saved/massif_shared_ptr.txt +++ /dev/null @@ -1,65 +0,0 @@ --------------------------------------------------------------------------------- -Command: ./test_shared_ptr -Massif arguments: --time-unit=B --threshold=0.001 -ms_print arguments: --threshold=0.001 massif.out.14810 --------------------------------------------------------------------------------- - - - KB -72.07^ # - | :#:::::::::::::::::::::::::::::::::: - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - 0 +----------------------------------------------------------------------->KB - 0 144.1 - -Number of snapshots: 8 - Detailed snapshots: [4 (peak)] - --------------------------------------------------------------------------------- - n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) --------------------------------------------------------------------------------- - 0 0 0 0 0 0 - 1 73,736 73,736 73,728 8 0 - 2 73,760 73,760 73,732 28 0 - 3 73,800 73,800 73,756 44 0 - 4 73,800 73,800 73,756 44 0 -99.94% (73,756B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. -->99.90% (73,728B) 0x491B73D: pool (eh_alloc.cc:235) -| ->99.90% (73,728B) 0x491B73D: UnknownInlinedFun (eh_alloc.cc:373) -| ->99.90% (73,728B) 0x491B73D: _GLOBAL__sub_I_eh_alloc.cc (eh_alloc.cc:456) -| ->99.90% (73,728B) 0x4005236: call_init (dl-init.c:74) -| ->99.90% (73,728B) 0x4005236: call_init (dl-init.c:26) -| ->99.90% (73,728B) 0x400532C: _dl_init (dl-init.c:121) -| ->99.90% (73,728B) 0x401BBEF: ??? (in /usr/lib64/ld-linux-x86-64.so.2) -| -->00.03% (24B) 0x4015A7: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(int*) (shared_ptr_base.h:917) -| ->00.03% (24B) 0x40156E: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(int*, std::integral_constant) (shared_ptr_base.h:928) -| ->00.03% (24B) 0x401535: std::__shared_ptr::__shared_ptr(int*) (shared_ptr_base.h:1469) -| ->00.03% (24B) 0x4013DE: std::shared_ptr::shared_ptr(int*) (shared_ptr.h:214) -| ->00.03% (24B) 0x4011CA: main (shared_ptr.cpp:7) -| -->00.01% (4B) 0x4011AC: main (shared_ptr.cpp:7) - --------------------------------------------------------------------------------- - n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) --------------------------------------------------------------------------------- - 5 73,824 73,776 73,752 24 0 - 6 73,864 73,736 73,728 8 0 - 7 147,600 0 0 0 0 diff --git a/tests/perf/memory/saved/massif_shared_ref.txt b/tests/perf/memory/saved/massif_shared_ref.txt deleted file mode 100644 index 80261cf..0000000 --- a/tests/perf/memory/saved/massif_shared_ref.txt +++ /dev/null @@ -1,60 +0,0 @@ --------------------------------------------------------------------------------- -Command: ./test_shared_ref -Massif arguments: --time-unit=B --threshold=0.0001 -ms_print arguments: --threshold=0.0001 massif.out.4571 --------------------------------------------------------------------------------- - - - KB -72.07^ # - | :#:::::::::::::::::::::::::::::::::: - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - 0 +----------------------------------------------------------------------->KB - 0 144.1 - -Number of snapshots: 8 - Detailed snapshots: [4 (peak)] - --------------------------------------------------------------------------------- - n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) --------------------------------------------------------------------------------- - 0 0 0 0 0 0 - 1 73,736 73,736 73,728 8 0 - 2 73,760 73,760 73,732 28 0 - 3 73,800 73,800 73,764 36 0 - 4 73,800 73,800 73,764 36 0 -99.95% (73,764B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. -->99.90% (73,728B) 0x4918491: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.32) -| ->99.90% (73,728B) 0x400536D: call_init.part.0 (dl-init.c:90) -| ->99.90% (73,728B) 0x4005472: call_init (dl-init.c:136) -| ->99.90% (73,728B) 0x4005472: _dl_init (dl-init.c:137) -| ->99.90% (73,728B) 0x401EB6F: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) -| -->00.04% (32B) 0x10938E: sm::internal::ControlBlockWrapper::ControlBlockWrapper(int*) (control_block.hpp:63) -| ->00.04% (32B) 0x109116: main (shared_ref.cpp:7) -| -->00.01% (4B) 0x109105: main (shared_ref.cpp:7) - --------------------------------------------------------------------------------- - n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) --------------------------------------------------------------------------------- - 5 73,824 73,776 73,760 16 0 - 6 73,864 73,736 73,728 8 0 - 7 147,600 0 0 0 0 diff --git a/tests/perf/memory/saved/massif_shared_ref_old.txt b/tests/perf/memory/saved/massif_shared_ref_old.txt deleted file mode 100644 index 80a45c2..0000000 --- a/tests/perf/memory/saved/massif_shared_ref_old.txt +++ /dev/null @@ -1,68 +0,0 @@ --------------------------------------------------------------------------------- -Command: ./test_shared_ref -Massif arguments: --time-unit=B --threshold=0.001 -ms_print arguments: --threshold=0.001 massif.out.13671 --------------------------------------------------------------------------------- - - - KB -72.11^ # - | :#:::::::::::::::::::::::::::::::::: - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - | :# - 0 +----------------------------------------------------------------------->KB - 0 144.2 - -Number of snapshots: 10 - Detailed snapshots: [5 (peak)] - --------------------------------------------------------------------------------- - n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) --------------------------------------------------------------------------------- - 0 0 0 0 0 0 - 1 73,736 73,736 73,728 8 0 - 2 73,760 73,760 73,732 28 0 - 3 73,800 73,800 73,756 44 0 - 4 73,840 73,840 73,780 60 0 - 5 73,840 73,840 73,780 60 0 -99.92% (73,780B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. -->99.85% (73,728B) 0x491B73D: pool (eh_alloc.cc:235) -| ->99.85% (73,728B) 0x491B73D: UnknownInlinedFun (eh_alloc.cc:373) -| ->99.85% (73,728B) 0x491B73D: _GLOBAL__sub_I_eh_alloc.cc (eh_alloc.cc:456) -| ->99.85% (73,728B) 0x4005236: call_init (dl-init.c:74) -| ->99.85% (73,728B) 0x4005236: call_init (dl-init.c:26) -| ->99.85% (73,728B) 0x400532C: _dl_init (dl-init.c:121) -| ->99.85% (73,728B) 0x401BBEF: ??? (in /usr/lib64/ld-linux-x86-64.so.2) -| -->00.03% (24B) 0x40137D: sm::shared_ref::shared_ref(int*) (shared_ref.hpp:24) -| ->00.03% (24B) 0x4011AA: main (shared_ref.cpp:7) -| -->00.03% (24B) 0x401425: sm::internal::ControlBlock::ControlBlock(int*) (control_block.hpp:46) -| ->00.03% (24B) 0x401395: sm::shared_ref::shared_ref(int*) (shared_ref.hpp:24) -| ->00.03% (24B) 0x4011AA: main (shared_ref.cpp:7) -| -->00.01% (4B) 0x40118C: main (shared_ref.cpp:7) - --------------------------------------------------------------------------------- - n time(B) total(B) useful-heap(B) extra-heap(B) stacks(B) --------------------------------------------------------------------------------- - 6 73,864 73,816 73,776 40 0 - 7 73,904 73,776 73,752 24 0 - 8 73,944 73,736 73,728 8 0 - 9 147,680 0 0 0 0 diff --git a/tests/perf/speed/saved/asus_shared_ptr.txt b/tests/perf/speed/saved/asus_shared_ptr.txt deleted file mode 100644 index b51a737..0000000 --- a/tests/perf/speed/saved/asus_shared_ptr.txt +++ /dev/null @@ -1 +0,0 @@ -Took 85.47 ms average; 100 iterations diff --git a/tests/perf/speed/saved/asus_shared_ref.txt b/tests/perf/speed/saved/asus_shared_ref.txt deleted file mode 100644 index 169da49..0000000 --- a/tests/perf/speed/saved/asus_shared_ref.txt +++ /dev/null @@ -1 +0,0 @@ -Took 136.88 ms average; 100 iterations diff --git a/tests/perf/speed/saved/lenovo_shared_ptr.txt b/tests/perf/speed/saved/lenovo_shared_ptr.txt deleted file mode 100644 index 74a63dd..0000000 --- a/tests/perf/speed/saved/lenovo_shared_ptr.txt +++ /dev/null @@ -1 +0,0 @@ -Took 185.55 ms average; 100 iterations diff --git a/tests/perf/speed/saved/lenovo_shared_ref.txt b/tests/perf/speed/saved/lenovo_shared_ref.txt deleted file mode 100644 index 5759642..0000000 --- a/tests/perf/speed/saved/lenovo_shared_ref.txt +++ /dev/null @@ -1 +0,0 @@ -Took 107.89 ms average; 100 iterations