beyond-all-reason / beyond-all-reason/RecoilEngine

Feature Request: Threadpool returning sortable vectors

Open
#1,195 4 comments 0 reactions 0 assignees View on GitHub
refactor
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

In my mind, it sounds like it could be a fun addition to have a for_mt function that would take struct vector type argument, and do work on some iterable, and return the results of each thread in a separate vector. Optionally, as a last step, each thread could sort its own vector, with the final mergesort of all vectors of each thread being hopefully less taxing given each thread is already sorted.

Here is the engine implementation of the current for_mt stuff:
https://github.com/beyond-all-reason/spring/blob/BAR105/rts/System/Threading/ThreadPool.cpp

In my simple mind, it would work like this:

![image](https://github.com/beyond-all-reason/spring/assets/109391/ffcb0441-a3a7-4273-96fc-03836eaa38e1)

Contributor guide

Open the contributing guide

Research direction

Start by reading rts/System/Threading/ThreadPool.cpp and the existing for_mt implementation. Clarify the proposed API, per-thread vector ownership, optional sorting, and final merge behavior before changing the thread-pool design. Done means the feature's scope and behavior are agreed and the implementation is validated against the existing thread-pool use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.