From 72d5905db8a0a4458c674c81893797ccf7e57d12 Mon Sep 17 00:00:00 2001 From: LuoZhihao Date: Fri, 25 Jul 2025 23:42:37 +0800 Subject: [PATCH] Improve descriptions of `LocalVector`, recommend it when appropriate --- contributing/development/core_and_modules/core_types.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contributing/development/core_and_modules/core_types.rst b/contributing/development/core_and_modules/core_types.rst index 781c0b81d0a..41935b2a380 100644 --- a/contributing/development/core_and_modules/core_types.rst +++ b/contributing/development/core_and_modules/core_types.rst @@ -146,6 +146,7 @@ scripting API. +-----------------------+--------------------------+---------------------------------------------------------------------------------------+ | |vector| | ``std::vector`` | **Use this as the "default" vector type.** Uses copy-on-write (COW) semantics. | | | | This means it's generally slower but can be copied around almost for free. | +| | | Use ``LocalVector`` instead where COW isn't needed and performance matters. | +-----------------------+--------------------------+---------------------------------------------------------------------------------------+ | |hash_set| | ``std::unordered_set`` | **Use this as the "default" set type.** | +-----------------------+--------------------------+---------------------------------------------------------------------------------------+ @@ -156,8 +157,8 @@ scripting API. | |string_name| 📜 | ``std::string`` | Uses string interning for fast comparisons. Use this for static strings that are | | | | referenced frequently and used in multiple locations in the engine. | +-----------------------+--------------------------+---------------------------------------------------------------------------------------+ -| |local_vector| | ``std::vector`` | Closer to ``std::vector`` in semantics. In most situations, ``Vector`` should be | -| | | preferred. | +| |local_vector| | ``std::vector`` | Closer to ``std::vector`` in semantics, doesn't use copy-on-write (COW) | +| | | thus it's faster than ``Vector`` for frequent write operations. | +-----------------------+--------------------------+---------------------------------------------------------------------------------------+ | |array| 📜 | ``std::vector`` | Values can be of any Variant type. No static typing is imposed. | | | | Uses shared reference counting, similar to ``std::shared_ptr``. |