Skip to content

feat(base): what prosperity needs to drop the STL - #24

Merged
Force67 merged 10 commits into
devel5from
feat/shared-pointer-recursive-mutex-bitcast
Sep 27, 2026
Merged

Force67 merged 10 commits into
devel5from
feat/shared-pointer-recursive-mutex-bitcast

Conversation

@Force67

@Force67 Force67 commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Everything base lacked for prosperity to replace its STL use, plus two bugs found on the way. Each change has tests; the container and threading ones also pass under ASan/UBSan and TSan.

New:

  • HashMap / HashSet: chained, node-based, the std::unordered_map contract (stable references, iterator find/erase, emplace). UnorderedMap/StableMap stay for the pointer-returning style.
  • SharedPointer (MakeShared, thread-safe count), RecursiveMutex, BitCast.
  • SpawnDetachedThread, IsCurrentThread, Thread::handle(). Windows halves written but not compiled here.
  • ConditionVariable::WaitFor/WaitUntil with a predicate.
  • Map/Set lower_bound/upper_bound and operator--; Vector::insert(T&&); CopyN, NoneOf, EraseIf on node containers, Min/Max over a list, lexicographic Array/Vector operator<, Prev/Next, is_pointer_v, remove_const_t.
  • ArraySize is constexpr and accepts const arrays, so it can size an Array.

Perf:

  • ConditionVariable skips the wake syscall when nobody waits (waiter count next to the futex word). Prosperity's render queue notifies per submit, mostly with no one waiting.

Fixed:

  • Set's iterator dropped the ancestor stack when it stepped into a right subtree: a 100-element set iterated 3 elements. Set now walks the tree like Map and has a std::set-shaped insert/find/erase.

…ration for Map and Set

Set's stack walker dropped the ancestors whenever it stepped into a right subtree, so a 100-element set iterated 3. Set now walks the tree's successor/predecessor like Map, with a std::set-shaped insert/find/erase. Both gain lower_bound/upper_bound and operator--.
Node-based chaining: references survive inserts and rehashes, find returns an iterator, erase(iterator) returns the next. Fibonacci bucket indexing spreads hashers that leave structure in their low bits.
@Force67 Force67 changed the title feat(base): SharedPointer, RecursiveMutex and BitCast feat(base): what prosperity needs to drop the STL Sep 27, 2026
@Force67
Force67 merged commit 17f64c6 into devel5 Sep 27, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant