ad600125df
Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.
...
Remove cross-project includes from `hashfuncs.h`.
Improve hashing function for `Color` (based on values instead of `String`).
Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used.
Remove now unnecessary `HashableHasher`.
2025-10-05 01:49:11 +02:00
c993db9688
Add reserve_exact to CowData and Vector.
...
Change growth factor to be an indeterministic 1.5x.
Use `reserve_exact` in `FileAccess` to reduce on binary file loading RAM usage.
# Conflicts:
# core/templates/cowdata.h
2025-10-01 11:57:40 +02:00
55ac91b887
Merge pull request #111084 from Ivorforce/cowdata-reserve-verbose
...
Make `CowData::reserve` warn message when new capacity < size verbose, like other `reserve` methods
2025-09-30 18:35:23 -05:00
e5bf31b170
Merge pull request #107369 from Ivorforce/node-iter-children
...
Core: Add `Node::iterate_children` as a fast way to iterate a node's children
2025-09-30 18:35:21 -05:00
4d13966c08
Merge pull request #108698 from Brogolem35/hashset_clear_optimize
...
Optimize and clean up HashSet::clear
2025-09-30 18:35:01 -05:00
8f533897d8
Make CowData::reserve warn message when new capacity < size verbose, like other reserve methods.
2025-09-30 20:21:02 +02:00
21fd4faf1b
Merge pull request #107469 from Ivorforce/vector-localvector-explicit-span-conversions
...
Remove implicit conversions between `LocalVector` and `Vector`
2025-09-30 11:19:17 -05:00
1bf821c1e1
Store current capacity in CowData buffers, and rewrite most of it.
...
Add `reserve` to `CowData`, `Vector` and `Array`.
# Conflicts:
# core/os/memory.h
# core/templates/cowdata.h
2025-09-25 22:00:17 +02:00
5fda92451d
Merge pull request #100145 from Ivorforce/memory-offset-func
...
Add `mem_aligned_address` to simplify data offset constants.
2025-09-25 14:57:09 -05:00
3ac159094f
Add memory_get_offset to simplify data offset constants.
2025-09-25 20:55:33 +02:00
c6f57c7a55
Change "reserve called with a capacity smaller than the current size" error message to a verbose message.
2025-09-23 20:02:40 +02:00
9b7a723aac
Merge pull request #107721 from YYF233333/ps_include
...
Remove dependency of `variant.h` in `print_string.h`
2025-09-22 08:50:04 -05:00
7685cb6f48
Optimize clear
2025-09-21 10:19:12 +03:00
40bd86819b
Merge pull request #104332 from ColinSORourke/FindSeq
...
Add 'Find Sequence' to `Span`s, and consolidate negative indexing behavior
2025-09-20 13:41:34 -05:00
05dae23f18
Remove dependency of variant.h in print_string.h
...
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com >
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com >
2025-09-19 14:57:36 +08:00
46b88dcbda
Rename internal fields and variables in AHashMap, HashMap and HashSet for consistency.
2025-09-17 19:10:02 +02:00
abe3b481ae
Make conversions from LocalVector to Vector explicit.
2025-09-16 21:41:28 +02:00
03d32c68a9
Added Find Sequence to Spans
...
Added FindSequence to Span.h
Refactored String find to use Span::Find_Seq in Ustring.cpp
2025-09-16 12:37:07 -07:00
25115609ff
Fix issue with array comparison reference
2025-07-09 20:22:09 -07:00
697e0bb077
Use reserve in LocalVector::resize, to restore expected growth behavior.
2025-06-21 11:23:05 +02:00
ac6252c9c8
Merge pull request #107486 from Ivorforce/rendering-no-alloc-api
...
Use raw buffer pointers in `RenderingDevice` allocation APIs to avoid intermediary arrays
2025-06-18 18:14:00 -05:00
2b36c79f7b
Use Span<uint8_t> in RenderingDevice allocation APIs to avoid intermediary arrays on calls.
2025-06-18 12:31:48 +02:00
296aba7dc5
Fix CSV translation not updating after reimport
2025-06-17 17:22:49 +08:00
a11a64fbf4
Comments spelling fixes
2025-06-15 01:36:10 +02:00
175c38d0dc
Core: Add Node::iterate_children as a fast way to iterate a node's children, without needing allocations or get_child.
...
Adds `Iterable` class to templates.
2025-06-13 17:01:51 +02:00
2d0ff9774d
Add a smoke test to Span in debug builds to recover from non-empty nullptr Span.
2025-06-12 12:19:21 +02:00
d2f9d31270
Make more types (Callable, Signal) conversion to String explicit.
2025-06-10 23:55:35 +02:00
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