From ab1391d99286384b87cd6db0f4750fe25a51a548 Mon Sep 17 00:00:00 2001 From: Sanhaoji2 Date: Fri, 11 Jul 2025 21:07:55 +0800 Subject: [PATCH 1/2] try reserve 5k --- include/neighbor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/neighbor.h b/include/neighbor.h index 9b1c54eac..6b131591e 100644 --- a/include/neighbor.h +++ b/include/neighbor.h @@ -315,7 +315,8 @@ class NeighborExtendColorVector : public NeighborVectorBase { std::cout << "unique seller " << uniqueSellerCount << "ColorInfoMap created" << std::endl; auto color_to_info = std::make_unique(); - color_to_info->reserve(uniqueSellerCount); + uint32_t reserve_size = 5000; + color_to_info->reserve(reserve_size); _color_to_info = std::move(color_to_info); } } From de14f38fb29c4b0c4eb5f1171647f5b9eaf1e2c0 Mon Sep 17 00:00:00 2001 From: Sanhaoji2 Date: Sat, 12 Jul 2025 18:30:22 +0800 Subject: [PATCH 2/2] try smaller number --- include/neighbor.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/neighbor.h b/include/neighbor.h index 6b131591e..c1e15762b 100644 --- a/include/neighbor.h +++ b/include/neighbor.h @@ -127,7 +127,8 @@ class NeighborVector : public NeighborVectorBase class NeighborExtendColorVector : public NeighborVectorBase { public: - const static uint32_t s_vector_size_limited = 1000000; + const static uint32_t s_vector_size_limited = 50 * 64; + const static uint32_t s_map_size_reserve = 100; NeighborExtendColorVector(const std::vector& location_to_seller) : _location_to_seller(location_to_seller) @@ -148,7 +149,7 @@ class NeighborExtendColorVector : public NeighborVectorBase else { auto color_to_info = std::make_unique(); - color_to_info->reserve(uniqueSellerCount); + color_to_info->reserve(s_map_size_reserve); _color_to_info = std::move(color_to_info); } } @@ -315,8 +316,7 @@ class NeighborExtendColorVector : public NeighborVectorBase { std::cout << "unique seller " << uniqueSellerCount << "ColorInfoMap created" << std::endl; auto color_to_info = std::make_unique(); - uint32_t reserve_size = 5000; - color_to_info->reserve(reserve_size); + color_to_info->reserve(s_map_size_reserve); _color_to_info = std::move(color_to_info); } }