Bug 1812828 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

ChildCommandDispatcher two local nsTArray variables:
https://searchfox.org/mozilla-central/rev/ef5dad8c11a556acd68ca3b9dcd77b226e0aaa29/dom/base/nsGlobalWindowOuter.cpp#6394,6404-6406
```cpp
class ChildCommandDispatcher : public Runnable {
...
  NS_IMETHOD Run() override {
    nsTArray<nsCString> enabledCommands, disabledCommands;
    mRoot->GetEnabledDisabledCommands(enabledCommands, disabledCommands);
```
In a local speedometer run, I got two samples where we were calling `AppendElement` on one of those arrays:
https://share.firefox.dev/3XEzrCj

I did a local run to print out the sizes of these arrays, to see what the space-of-common-values is like, on my linux system at least.  During a Speedoometer 3 run, `enabledCommands` topped out at 62, while `disabledCommands` topped out at 70.

Let's just use AutoTArray<70> for both of these, to avoid reallocation churn.  (Even if we occasionally overshoot 70 by a bit, we'll probably only have to dynamically allocate once, instead of several times.)
ChildCommandDispatcher two local nsTArray variables:
https://searchfox.org/mozilla-central/rev/ef5dad8c11a556acd68ca3b9dcd77b226e0aaa29/dom/base/nsGlobalWindowOuter.cpp#6394,6404-6406
```cpp
class ChildCommandDispatcher : public Runnable {
...
  NS_IMETHOD Run() override {
    nsTArray<nsCString> enabledCommands, disabledCommands;
    mRoot->GetEnabledDisabledCommands(enabledCommands, disabledCommands);
```
In a local speedometer run, I got two samples where we were calling `AppendElement` on one of those arrays:
https://share.firefox.dev/3XEzrCj

I did a local run to print out the sizes of these arrays, to see what the space-of-common-values is like, on my linux system at least.  During a Speedoometer 3 run, `enabledCommands` topped out at 62, while `disabledCommands` topped out at 70.

Let's just use `AutoTArray<70>` for both of these, to avoid reallocation churn.  (Even if we occasionally overshoot 70 by a bit, we'll probably only have to dynamically allocate once, instead of several times.)
ChildCommandDispatcher two local nsTArray variables:
https://searchfox.org/mozilla-central/rev/ef5dad8c11a556acd68ca3b9dcd77b226e0aaa29/dom/base/nsGlobalWindowOuter.cpp#6394,6404-6406
```cpp
class ChildCommandDispatcher : public Runnable {
...
  NS_IMETHOD Run() override {
    nsTArray<nsCString> enabledCommands, disabledCommands;
    mRoot->GetEnabledDisabledCommands(enabledCommands, disabledCommands);
```
In a local speedometer run, I got two samples where we were calling `AppendElement` on one of those arrays:
https://share.firefox.dev/3XEzrCj

I did a local run to print out the sizes of these arrays, to see what the space-of-common-values is like, on my linux system at least.  During a Speedoometer 3 run, `enabledCommands` topped out at 62, while `disabledCommands` topped out at 70.

So, let's just use `AutoTArray` with capacity `70` for both of these, to avoid reallocation churn.  (Even if we occasionally overshoot 70 by a bit, we'll probably only have to dynamically allocate once, instead of several times.)

Back to Bug 1812828 Comment 0