Closed Bug 834108 Opened 9 years ago Closed 9 years ago

avoid O(n^2) chunk-searching in LifoAlloc::ensureUnusedApproximate

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: luke, Assigned: luke)

Details

Attachments

(1 file)

Attached patch fixSplinter Review
IM calls ensureUnusedApproximate after all dynamic allocations (and lots of other places) to ensure there is still 16KB free in the LifoAlloc.  The problem is that, when a new chunk needs to be allocated, ensureUnusedApproximateSlow (true to its name) uses LifoAllocScope which does a LifoAlloc::release which does an O(n) search to find the chunk containing the given mark.  Thus, for n bytes of allocation, there is O(n^2) chunk-searching.

Really, all the code wants to do is keep 'latest' unchanged, so this patch does that.  This change cuts the compilation time of sqlite.js in OdinMonkey almost in half.  There seems to be a slight speedup in --v8-suite run from the SS harness.
Attachment #705693 - Flags: review?(dvander)
Attachment #705693 - Flags: review?(dvander) → review+
Looks like this bug *might* have blown up PdfJS and, to a lesser degree, Splay on 32-bit AWFY.
Don't know about 64-bit on AWFY, since it has been down for quite some time.
(In reply to Paul Wright from comment #2)
> Looks like this bug *might* have blown up PdfJS and, to a lesser degree,
> Splay on 32-bit AWFY.

It appears to have been a temporary fluke.
(In reply to Sean Stangl from comment #4)
> (In reply to Paul Wright from comment #2)
> > Looks like this bug *might* have blown up PdfJS and, to a lesser degree,
> > Splay on 32-bit AWFY.
> 
> It appears to have been a temporary fluke.

Yep, false alarm... My bad.  The 64-bit issue is real, though.
https://hg.mozilla.org/mozilla-central/rev/cf6169428098
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.