Closed
Bug 661068
Opened 14 years ago
Closed 13 years ago
Create TraceMonitors lazily
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: n.nethercote, Assigned: n.nethercote)
References
Details
(Whiteboard: [MemShrink:P2][fixed-in-tracemonkey])
Attachments
(1 file)
15.80 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
When a JaegerCompartment is created, it always generates some code immediately in the TrampolineCompiler, which involves mapping 64KB of executable memory (64KB is the minimum code chunk size). This shouldn't be necessary for atomsCompartment. It should be easy to add a boolean flag |hasCode| somewhere to JaegerCompartment and avoid this for atomsCompartment. A small win but an easy one.
Assignee | ||
Comment 1•14 years ago
|
||
We're also allocating 186,000 bytes worth of space for trace JIT data, which is unnecessary for the atomsCompartment. And probably a bit more for various heap allocations done in TraceMonitor::init(). We should avoid that too.
Assignee | ||
Updated•14 years ago
|
Summary: atomsCompartment doesn't need a JaegerCompartment → atomsCompartment doesn't need a JaegerCompartment or a TraceMonitor
Assignee | ||
Comment 2•14 years ago
|
||
This idea can be extended. Some compartments have tiny amounts of JS code in them which never gets method JITted and/or trace JITted (eg. techcrunch.com's front page has dozens of them). Doing lazy initialization/allocation of the relevant code and data chunks could save quite a bit of space.
Summary: atomsCompartment doesn't need a JaegerCompartment or a TraceMonitor → atomsCompartment doesn't need a JaegerCompartment or a TraceMonitor, nor do some other compartments
Whiteboard: [MemShrink:P2]
Assignee | ||
Updated•14 years ago
|
Summary: atomsCompartment doesn't need a JaegerCompartment or a TraceMonitor, nor do some other compartments → Create JaegerCompartments and TraceMonitors lazily
Comment 3•13 years ago
|
||
Thanks for pointing me to this Nick. bug 650411 should help a lot since both in theory can be hoisted to the (single-threaded) JSRuntime (which should be very few in number).
Assignee | ||
Comment 4•13 years ago
|
||
(In reply to comment #3) > Thanks for pointing me to this Nick. bug 650411 should help a lot since > both in theory can be hoisted to the (single-threaded) JSRuntime (which > should be very few in number). The entire JaegerCompartment and TraceMonitor could be hoisted? That'd be very nice.
Comment 5•13 years ago
|
||
Yep (the comment for JaegerCompartment explains that all it wants is single-threadedness).
Assignee | ||
Comment 6•13 years ago
|
||
Luke, it sounds like a single-threaded JSRuntime won't happen soon. Assuming that's right, I'll go ahead with this bug, because my per-compartments patch for about:memory shows that it's really easy to get dozens and dozens of tiny compartments, and the thought of wasting 0.25MB on each one is giving me an ulcer.
Assignee | ||
Comment 7•13 years ago
|
||
This patch does the TraceMonitor. Here's an example from about:memory: │ └──────65,536 B (00.14%) -- compartment(atoms) │ ├──65,536 B (00.14%) -- mjit-code │ ├───────0 B (00.00%) -- scripts │ ├───────0 B (00.00%) -- mjit-data │ ├───────0 B (00.00%) -- tjit-code │ └───────0 B (00.00%) -- tjit-data │ ├──0 B (00.00%) -- allocators-main │ └──0 B (00.00%) -- allocators-reserve 186,000 bytes down, 65,536 to go. I'll do the patch for the JaegerCompartment on Monday.
Attachment #540002 -
Flags: review?(luke)
Assignee | ||
Comment 8•13 years ago
|
||
(In reply to comment #7) > > 186,000 bytes down Actually, on 64-bit it's more like 256KB because there are various other things (most notably the TraceNativeStorage) in the TraceMonitor that aren't captured in the memory reporters. On 32-bit it's a bit less.
Comment 9•13 years ago
|
||
Comment on attachment 540002 [details] [diff] [review] make TraceMonitor lazy Nice; ulcers are bad.
Attachment #540002 -
Flags: review?(luke) → review+
Assignee | ||
Updated•13 years ago
|
Summary: Create JaegerCompartments and TraceMonitors lazily → Create TraceMonitors lazily
Assignee | ||
Comment 10•13 years ago
|
||
I've narrowed the focus of this bug just to TraceMonitor; JaegerCompartment is now covered by bug 665404.
No longer blocks: 665404
Assignee | ||
Comment 11•13 years ago
|
||
Landed with a follow-up to fix some --disable-tracejit bustage: http://hg.mozilla.org/tracemonkey/rev/1e464e38591e http://hg.mozilla.org/tracemonkey/rev/57ef3b619966
Whiteboard: [MemShrink:P2] → [MemShrink:P2][fixed-on-tracemonkey]
Comment 12•13 years ago
|
||
cdleary-bot mozilla-central merge info: http://hg.mozilla.org/mozilla-central/rev/1e464e38591e http://hg.mozilla.org/mozilla-central/rev/57ef3b619966 Note: not marking as fixed because fixed-in-tracemonkey is not present on the whiteboard.
Updated•13 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [MemShrink:P2][fixed-on-tracemonkey] → [MemShrink:P2][fixed-in-tracemonkey]
You need to log in
before you can comment on or make changes to this bug.
Description
•