[C++] Replace ThreadIndexer with a more performant thread-local implementation
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 91
Description
Many of the ExecNode operations use thread local state (mostly temporary buffers) to avoid per-batch allocation. Currently we are using ThreadIndexer but to get the thread local state requires locking a mutex and a map lookup. For some of the critical sections we are developing in hash-join this has become a bottleneck. Ideally we can replace this with something that relies on thread local state instead of a map shared across all threads.
**Reporter**: [Weston Pace](https://issues.apache.org/jira/browse/ARROW-16177) / @westonpace
#### Subtasks:
- [ ] [[C++] Add a ThreadLocalState concept built on thread local](https://github.com/apache/arrow/issues/31581)
- [ ] [[C++] Migrate existing usage of ThreadIndexer to ThreadLocalState and get rid of ThreadIndexer](https://github.com/apache/arrow/issues/31582)
**Note**: *This issue was originally created as [ARROW-16177](https://issues.apache.org/jira/browse/ARROW-16177). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*
Contributor guide
Research direction
Start with subtasks #31581 and #31582, then inspect the existing ThreadIndexer usage in ExecNode operations. The goal is to introduce thread-local state and migrate existing usages so mutex and shared-map lookups are no longer required; done when ThreadIndexer can be removed and the affected operations use the new implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100