Commit Graph

316 Commits

Author SHA1 Message Date
d2814ebbf3 Add missing Color hash function 2025-06-08 14:49:50 -04:00
61639d9574 Merge pull request #106996 from Ivorforce/no-oa-hashmap
Core: Remove `OAHashMap`, in favour of `AHashMap`
2025-06-05 13:12:34 +02:00
6b2674fe18 Reuse and optimize sorting logic for List, SelfList, and HashMap
Added SortList class, and updated List, SelfList, and HashMap sort methods to use it.  Sorting is done with merge sort, with an initial check to optimize for already sorted lists, and sorted lists that were appended to.
2025-06-04 10:18:22 -04:00
7a3d2f6779 Merge pull request #106606 from aaronfranke/pow2_64
Add 64-bit versions of core power of 2 functions
2025-06-02 18:51:56 -05:00
f6f1df7d73 Add 64-bit versions of core power of 2 functions 2025-06-01 23:11:12 -07:00
963c20565b Remove OAHashMap, in favour of AHashMap.
The two types had (mostly) the same decisions, but `AHashMap` is a faster implementation, and is more consistent with `HashMap`.
2025-05-31 15:50:10 +02:00
21e2bac382 Add missing headers in FixedVector and Span 2025-05-30 13:41:45 +08:00
2cde9292c3 Merge pull request #106876 from Ivorforce/localvector-no-force-trivial
Un-support `force_trivial` parameter for `LocalVector`. Instead, users should use `resize_uninitialized`.
2025-05-28 09:47:45 -05:00
37415530d7 Un-support force_trivial parameter for LocalVector. Instead, users are reformatted to use resize_uninitialized to make it explicit that the resize does not initialize missing elements. 2025-05-27 18:43:36 +02:00
d2d57849de Add a safety check for CowData::_unref(), for when something tries to add elements during destruction. 2025-05-27 18:00:48 +02:00
0c12e758ac Merge pull request #106569 from Ivorforce/hashmap-if-mod
Accelerate `HashMap` and `HashSet` lookup by using `if` based modulo in loops
2025-05-27 09:39:29 -05:00
670ab7a383 Add resize_initialized and resize_uninitialized to LocalVector. 2025-05-26 18:35:41 +02:00
4cb8a0c77e Add resize_initialized and resize_uninitialized to Vector. These functions serve as replacements for resize, to make sure the caller understands whether elements need to be initialized 'by hand' after the call. 2025-05-26 18:35:41 +02:00
4371aa864d Simplify Memory::memnew_arr_placement to always initialize memory, to force callers to make the decision of whether to initialize. 2025-05-22 22:25:12 +02:00
15cd5e1619 Merge pull request #106689 from aaronp64/ringbuffer_localvector
Use `LocalVector` for `RingBuffer`
2025-05-22 12:15:03 -05:00
c3c3657a0d Merge pull request #106661 from KirbyRider1337/dont-compare-the-same-item-with-itself
Prevent comparison of items with themselves while partitioning sort arrays
2025-05-22 12:14:58 -05:00
caf8053b86 Adjusted get_median_from_3 and partitioner to also retrieve the pivot's index and check if either end of the partitioner has reached it to avoid comparing things with themselves 2025-05-21 14:38:09 -04:00
2a02cabe4d Use LocalVector for RingBuffer
Updated RingBuffer to use LocalVector instead of Vector, to avoid _copy_on_write overhead when writing to the buffer.
2025-05-21 13:50:10 -04:00
70f8dd29f5 Simplify use of LocalVector force_trivial template parameter. 2025-05-19 20:27:14 +02:00
2d42b889d1 Merge pull request #104124 from Ivorforce/alloc-static-calloc
Add `Memory::alloc_static_zeroed` to allocate memory that's filled with zeroes.
2025-05-19 08:01:33 -05:00
6fe17b264e Use if based mod in HashMap and HashSet in loops (faster than fastmod). 2025-05-18 20:05:34 +02:00
5538850d87 Core: Convert Pair/KeyValue to constexpr 2025-05-15 10:37:41 -05:00
3bf400ffae Move bisect to Span and deduplicate code.
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-05-14 18:19:09 +08:00
0babb2ab02 Optimize HashMap size for zero-sized Allocators. 2025-05-13 21:44:39 +08:00
3207066e19 Add Memory::alloc_static_zeroed to allocate memory that's filled with zeroes.
This is generally faster than `malloc` followed by `memset` / loop-set to 0.
2025-05-13 01:57:05 +02:00
4c62c8aceb Merge pull request #106020 from Ivorforce/hashmap-duplicate-hash
Optimize `HashMap` insertion by removing duplicate computation of hash and position
2025-05-13 01:04:57 +02:00
2b037e8989 Merge pull request #93276 from mashumafi/avoid-vec-copy
Avoid unnecessary copy-on-write Vector/Array
2025-05-13 01:04:16 +02:00
b73346ef19 Avoid copy-on-write when reading vectors 2025-05-12 16:08:05 +02:00
2db0a44519 Remove vmap.h 2025-05-09 19:05:28 +08:00
1d49a557b6 Optimize away duplicate hash and position computation in HashMap on insert.
Co-authored-by: Nazarii <nazarii.yablonskyi.pp.2022@lpnu.ua>
2025-05-02 19:02:03 +02:00
01fc9aee6c Core: Modernize C headers with C++ equivalents 2025-05-02 08:23:01 -05:00
1b1ab76a14 Add FixedVector template.
This is a high performance `Vector`-like object that can be used if the maximum number of objects is small and known, and the objects are needed only temporarily.
2025-04-30 19:14:08 +02:00
44d20b2dc6 Merge pull request #100619 from Ivorforce/cowdata-resize-direct
Optimize / refactor `CowData`, combining resize and fork to avoid unnecessary reallocations.
2025-04-28 18:45:54 -05:00
ae04a3a5dd Physics Interpolation - Move 3D FTI to SceneTree
Moves 3D interpolation from server to the client code (`SceneTree`).
Complete rework of 3D physics interpolation, but using the same user API.
2025-04-26 14:13:30 +01:00
d74ef8cb01 Rename LocalVector.invert() -> LocalVector.reverse() to match the Vector, String and List APIs. 2025-04-24 22:36:32 +02:00
7c37188ca1 Smoke test: In collections, log an error if reserve() is called with a number smaller than the current size. Don't log an error if it is called with a number smaller than the current capacity. 2025-04-23 16:47:47 +02:00
2ffd5a3913 Merge pull request #104738 from YYF233333/cleanup_rid_owner
Use `LocalVector` in `RID_Owner::get_owned_list`
2025-04-22 10:44:25 -05:00
c0e695d5e8 Merge pull request #100944 from Nazarwadim/LocalVector_use_1.5x_growth_factor
Use 1.5x growth factor for LocalVector
2025-04-21 08:24:22 -05:00
1a70a06a43 Change RID_Owner::get_owned_list. 2025-04-21 01:04:27 +08:00
c6c06a966a Allow chunk validator to wrap around in RID_Alloc so that we do not need to crash once we have made 2^31 allocations 2025-04-18 00:06:53 -07:00
015a3b0434 Optimize / refactor CowData, combining resize and fork to avoid unnecessary reallocations. 2025-04-15 17:01:26 +02:00
addab4f001 Merge pull request #95916 from Repiteo/core/bit-field
Core: Add dedicated `BitField` template
2025-04-11 13:29:13 -05:00
0d267e7b1e Core: Add dedicated BitField template 2025-04-11 11:53:26 -05:00
b711d72e8f Remove unnecessary friend class declarations of CowData.
Use default implementations for various containers.
2025-04-11 18:26:08 +02:00
94282d88f9 Core: Use Math namespace for constants 2025-04-10 16:29:30 -05:00
5edb235018 CI: Bump various pre-commit hooks 2025-04-07 08:23:35 -05:00
207a2b6472 Core: Integrate warning suppression macro helpers 2025-04-03 10:13:46 -05:00
ccdc5862e9 Add LocalVector.erase_unordered, mimicking erase but with remove_at_unordered, to remove duplicate logic.
`erase_unordered` should be preferred over `erase` where order is not important, for its performance benefits.

Co-authored-by: smix8 <smix8@users.noreply.github.com>
2025-03-31 13:31:53 +02:00
afc7398c2b Merge pull request #104616 from ibrahn/init-cmd-q-pending-and-gles3-skymatdata
Fix uninitialized member vars in CommandQueueMT and RasterizerSceneGLES3
2025-03-28 17:30:37 +01:00
4a31936bc1 Merge pull request #104693 from mihe/local-vector-move
Optimize `LocalVector::push_back` for non-trivial objects
2025-03-28 14:34:49 +01:00