mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 729453 - Decrease stack allocation in nsTArray::SwapArrayElements from 8KB to 64B. r=roc
This commit is contained in:
parent
722dd03f66
commit
fc32ec463a
@ -398,11 +398,11 @@ nsTArray_base<Alloc>::SwapArrayElements(nsTArray_base<Allocator>& other,
|
||||
}
|
||||
|
||||
// Allocate temporary storage for the smaller of the two arrays. We want to
|
||||
// allocate this space on the stack, unless it's very large. Sounds like a
|
||||
// allocate this space on the stack, if it's not too large. Sounds like a
|
||||
// job for AutoTArray! (One of the two arrays we're swapping is using an
|
||||
// auto buffer, so we're likely not allocating a lot of space here. But one
|
||||
// could, in theory, allocate a huge AutoTArray on the heap.)
|
||||
nsAutoTArray<PRUint8, 8192, Alloc> temp;
|
||||
nsAutoTArray<PRUint8, 64, Alloc> temp;
|
||||
if (!temp.SetCapacity(smallerLength * elemSize)) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user