Closed Bug 1087207 Opened 10 years ago Closed 10 years ago

Use a smaller initial size for the srcnotes vector

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

Attachments

(1 file)

BytecodeEmitter has vectors for bytecode and source notes. We want the initial
sizes of these vectors to be large enough that we don't have to do lots of
resizings.

But we don't also want them to be excessively large, because we allocate lots
of them. E.g. ~44,000 when I start the browser and load Gmail, TechCrunch and
CNN.

Currently we use 1024 bytes for the initial size of the bytecode vector, and
98% of the time that is big enough to avoid resizings, which seems reasonable.

We also use 1024 bytes for the initial size of the source notes vector, and
99.7% of the time that is big enough to avoid resizings, which seems a little
high. We can reduce it to 256 bytes and still avoid resizings 99% of the time.
(128 bytes takes us down to about 93%.)

(Note: all these measurements are for non-zero vectors. We also have plenty of
zero-length vectors because the prolog is often empty, but we already handle
that appropriately because we create the vectors lazily.)
Attachment #8509321 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/98d0bbc30817
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: