Open Bug 1940069 Opened 1 month ago Updated 1 month ago

Replace CompactBufferWriter's buffer allocation to use LifoAlloc

Categories

(Core :: JavaScript Engine: JIT, enhancement, P2)

enhancement

Tracking

()

People

(Reporter: nbp, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: [sp3])

CompactBufferWritter is currently using jemalloc backed allocation which implies that any resize of the vector will not only make a new allocation but also copy the old data. On other vectors we were able to predict ahead the expected sizes of the vectors and pre-allocate them, but the CompactBuffers are compressing the data. Attempts at predicting the sizes of these buffers has so far resulted in a lot of over/under approximations.

Thus, instead of attempting to estimate the sizes, we can simply rely on segmented buffers using either a mozilla::BufferList, implemented as a vector of variable size arrays, or a mozilla::SegmentedVector, implemented as a double linked list of fixed size arrays. (don't ask …)

The CompactBuffer varies in size in functions of their use cases, thus we should either go for a solution with variable segments capacity, or paramettrize with templates for each use case.

Severity: -- → N/A
Priority: -- → P2
Depends on: 1940070
Whiteboard: [sp3]
You need to log in before you can comment on or make changes to this bug.