`<exception>`: Optimize `exception_ptr` a bit
Open
Nobody has claimed this yet.
performance
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
It seems that we can optimize exception_ptr a bit without breaking ABI, given the internal implementation details actually use shared_ptr.
The following is possibly the full list but I'm not very sure.
- the default constructor and constructor from
nullptr_tcan just rely on the default member initializers (initializing both internal pointer members tonullptr). - the
swapfunction can juststd::swapboth pointer members. - the
operator==can just compare_Data1(which is equal to the result ofget()of the internally reinterpretedshared). - the assignment operator from
nullptr_tcanswap*thiswith the emptyexception_ptrfirst, which avoids one uninlined call to__ExceptionPtrAssign. operator bool()can just return_Data1 != nullptr.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the exception_ptr implementation and its internal shared_ptr representation, focusing on the default and nullptr constructors, swap, equality, nullptr assignment, and operator bool. Verify the proposed changes against the existing ABI assumptions; done means these operations are optimized without breaking ABI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100