Closed Bug 1074935 Opened 10 years ago Closed 9 years ago

Push psuedo-stack frames for js rope string flattening

Categories

(DevTools :: Performance Tools (Profiler/Timeline), defect)

defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
Firefox 43
Tracking Status
firefox43 --- fixed

People

(Reporter: fitzgen, Assigned: fitzgen)

References

Details

(Whiteboard: [devtools-platform])

Attachments

(1 file)

I got a huge speed up today for replacing a simple regexp with a charAt. A potential theory for why it was such a boon is that the regexp was flattening the js string. It could also be that charAt was inlined while the regexp wasn't, but that's besides the point.

The point is that flattening can be expensive for large ropes, and we have no insight from devtools into when it does or doesn't happen. It seems like the timeline is the right place to add this.
I think it would make sense to gate based on string length, and only add markers for large strings.
Another idea is: when you click on any marker in the timeline, it'd be nice to have more information about it, like the time spent, the associated callstack, etc. If we know some specific actions (like string flattening) happened during a script execution marker in the timeline, we could mention it next to it, in the sidebar or something.
Moving into the Profiler component. Filter on GUTHRIE'S WAVY CAKES.
Component: Developer Tools: Timeline → Developer Tools: Profiler
OS: Mac OS X → All
Hardware: x86 → All
Summary: Add timeline markers for js string flattening → [marker] Add timeline markers for js string flattening
After talking with Shu and/or Kannan a little while back, I believe that we decide that pushing a psuedostack frame made more sense.
Summary: [marker] Add timeline markers for js string flattening → Push psuedo-stack frames for js rope string flattening
Anyone know where in platform code this occurs?
(In reply to Jordan Santell [:jsantell] [@jsantell] from comment #6)
> Anyone know where in platform code this occurs?

https://dxr.mozilla.org/mozilla-central/source/js/src/vm/String.h#1252
(In reply to Nick Fitzgerald [:fitzgen][:nf] from comment #7)
> (In reply to Jordan Santell [:jsantell] [@jsantell] from comment #6)
> > Anyone know where in platform code this occurs?
> 
> https://dxr.mozilla.org/mozilla-central/source/js/src/vm/String.h#1252

(I'd use JSRope::flatten; ensureLinear also calls JSRope::flatten and is a lot more common than ensureFlat.)
(In reply to Jan de Mooij [:jandem] from comment #8)
> (In reply to Nick Fitzgerald [:fitzgen][:nf] from comment #7)
> > (In reply to Jordan Santell [:jsantell] [@jsantell] from comment #6)
> > > Anyone know where in platform code this occurs?
> > 
> > https://dxr.mozilla.org/mozilla-central/source/js/src/vm/String.h#1252
> 
> (I'd use JSRope::flatten; ensureLinear also calls JSRope::flatten and is a
> lot more common than ensureFlat.)

Ah, thanks!
Whiteboard: [devtools-platform]
Depends on: 1204167
Attachment #8660287 - Flags: review?(jdemooij)
Assignee: nobody → nfitzgerald
Status: NEW → ASSIGNED
Attachment #8660287 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/mozilla-central/rev/cce8e013f935
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: