Beads.js clock example is JS-bound

NEW
Unassigned

Status

()

defect
9 years ago
5 years ago

People

(Reporter: humph, Unassigned)

Tracking

({perf})

Trunk
x86
macOS
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

9 years ago
Chris Morgan is porting a Java sound library (Beads) to js and the audio data API.  He has a bunch of examples done already, like this clock.  His audio code doesn't seem to JIT well (or at least bogs down badly if it is JIT'ing), and I know you guys are often looking for real-world web stuff that is js-bound.  Looking at his code, I can already see ways to make this more traceable, and I'm helping him do that; however, if you don't know how to rewrite for trace (e.g., most of the web), this is bad.

Shark shows me this:

19.3%	19.3%	XUL	js::Interpret(...)
0.0%	19.0%	XUL	 RunTracer(js::VMFrame&, js::mjit::ic::MICInfo&)
0.0%	0.0%	XUL	 js::MonitorTracePoint(JSContext*, unsigned int&, bool&)
0.0%	0.0%	Unknown Library	 0x3dbb0c60 [unknown]
9.4%	9.4%	XUL	bool js::VisitFrameSlots<js::FlushNativeStackFrameVisitor>(js::FlushNativeStackFrameVisitor&, JSContext*, unsigned int, JSStackFrame*, JSStackFrame*)
6.2%	6.2%	XUL	bool js::VisitFrameSlots<js::CheckEntryTypeVisitor>(js::CheckEntryTypeVisitor&, JSContext*, unsigned int, JSStackFrame*, JSStackFrame*)
4.4%	4.4%	XUL	js::ExecuteTree(JSContext*, js::TreeFragment*, unsigned int&, js::VMSideExit**, js::VMSideExit**)
4.2%	4.2%	XUL	bool js::VisitFrameSlots<js::BuildNativeFrameVisitor>(js::BuildNativeFrameVisitor&, JSContext*, unsigned int, JSStackFrame*, JSStackFrame*)
4.2%	4.2%	XUL	js::LeaveTree(js::TraceMonitor*, js::TracerState&, js::VMSideExit*)
2.9%	2.9%	XUL	js::CheckGlobalObjectShape(JSContext*, js::TraceMonitor*, JSObject*, unsigned int*, js::Queue<unsigned short>**)
2.6%	2.6%	XUL	TypedArrayTemplate<float>::obj_getProperty(JSContext*, JSObject*, int, js::Value*)
2.5%	2.5%	XUL	js::MonitorLoopEdge(JSContext*, unsigned int&)
1.9%	1.9%	XUL	js::CheckEntryTypes(JSContext*, JSObject*, js::TreeFragment*)
Yeah, looks like we're spending about:  20% in (not under) js::Interpret  30% in tracejit-generated code.  10% under LeaveTree, about half of it visiting frame slots.   7% under CheckEntryTypes.   9% under JaegerShot called from that js::Interpret, mostly in jit-generated      stuff and stubs::GetElem. on float-typed arrays.   5% SlowCallFromIC doing a js::Invoke which does various stuff.  If I turn off content tracing, I still get slowness (though _maybe_ a bit less); now I get:  46% in methodjit-generated code  12% under stubs::GetElem on a float-typed array   8% under SlowCallFromIC   8% under stubs::SetElem on a float-typed array   6% under stubs::GetProp (mostly InlineGetProp self time and the propcache      fullTest).   4% under stubs::CallProp (self time and fullTest)   3% under stubs::Mod (self and fmod)   2% under stubs::ArgCnt, calling js_GetArgsProperty   2% under js_math_floorand some minor stuff.
Let's try this again:

  20% in (not under) js::Interpret
  30% in tracejit-generated code.
  10% under LeaveTree, about half of it visiting frame slots.
   7% under CheckEntryTypes.
   9% under JaegerShot called from that js::Interpret, mostly in jit-generated
      stuff and stubs::GetElem on float-typed arrays.
   5% SlowCallFromIC doing a js::Invoke which does various stuff.

If I turn off content tracing, I still get slowness (though _maybe_ a
bit less); now I get:

  46% in methodjit-generated code
  12% under stubs::GetElem on a float-typed array
   8% under SlowCallFromIC
   8% under stubs::SetElem on a float-typed array
   6% under stubs::GetProp (mostly InlineGetProp self time and the propcache
      fullTest).
   4% under stubs::CallProp (self time and fullTest)
   3% under stubs::Mod (self and fmod) 
   2% under stubs::ArgCnt, calling js_GetArgsProperty
   2% under js_math_floor

and some minor stuff.
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.