mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-04 23:40:20 +00:00
Bug 1353618
- Optimize storage of MozPromise::mThenValues. r=gerald
1. Set the capacity to 1 when IsExclusive is true. 2. Set it to 3 because Try shows we never have more the 3 elements when IsExclusive is false. MozReview-Commit-ID: dmIeE6ZTeh --HG-- extra : rebase_source : fc6b173d3a389d11424238f76cbae1f496155ba5 extra : source : c6203c27b8020999ed39ff43ddf5173f5111ef6b
This commit is contained in:
parent
c7495b1957
commit
4cff3416a0
@ -926,7 +926,9 @@ protected:
|
||||
#ifdef PROMISE_DEBUG
|
||||
uint32_t mMagic1 = sMagic;
|
||||
#endif
|
||||
nsTArray<RefPtr<ThenValueBase>> mThenValues;
|
||||
// Try shows we never have more than 3 elements when IsExclusive is false.
|
||||
// So '3' is a good value to avoid heap allocation in most cases.
|
||||
AutoTArray<RefPtr<ThenValueBase>, IsExclusive ? 1 : 3> mThenValues;
|
||||
#ifdef PROMISE_DEBUG
|
||||
uint32_t mMagic2 = sMagic;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user