Closed Bug 1586649 Opened 5 years ago Closed 3 years ago

[BinAST] Reduce the amount of allocation/free in context parser

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: arai, Unassigned)

References

Details

While reading BinAST context format, allocation/free frequently happens because of Vector and HashTable used while reading header,
and that results in locking Mutex frequently inside mozjemalloc.

We should try reducing the call for malloc/free, maybe by using different pre-allocated size, or different allocator/AllocPolicy, or adding yet another allocator/AllocPolicy with temporary space?

For what it's worth, normally, everything is Vector now.

I have tried to increase pre-allocated size, but doing it as a simple hack killed the stack :/

Given the following:

  • we know the required size at the allocation
  • no reallocation happens
  • many things have same life time

adding dedicated AllocPolicy with temporary space might work.

Also, about pre-alocated size, given allocating SingleLookupHuffmanTable.{values,saturated} with 1 happens frequently, we could add non-Vector based variant with fixed size array would work nicely.

Depends on: 1586971
Depends on: 1587271
Depends on: 1587678

Resolving BinAST bugs as Incomplete.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.