On 06/18/2015 03:37 PM, Frederik Braun wrote:
Hi,

I am planning to do a little analysis of FxOS Gaia to identify instances
of innerHTML assignments at runtime[1]. I am hoping this gives me a more
precise number about hot paths (in contrast to just looking at the
source code).

What kind of information would you like to get out from the analysis?
And before even spending too much time with innerHTML, are you sure the possible
performance issues are about it, and not about creating/reflowing layout 
objects for the new elements?
(innerHTML implementation is in common cases quite well optimized.)


If you end up hacking C++ side of innerHTML, the relevant code lives in
http://hg.mozilla.org/mozilla-central/annotate/a3f280b6f8d5/dom/base/FragmentOrElement.cpp#l2769
(except for style, HTMLStyleElement.cpp,  and script, HTMLScriptElement.cpp, 
elements which have different innerHTML behavior.)





In an ideal world I would write a script along the lines of
`Object.defineProperty(Element.prototype, 'innerHTML', …)` and inject
this into every app, or at best run it somewhere so that every Element's
prototype chains back to mine.

I know that I can not modify/inherit prototypes across origins, so I am
wondering if there is something I could do with chrome privileges -
maybe patching shell.js
(https://dxr.mozilla.org/mozilla-central/source/b2g/chrome/content/shell.js),
as it is the main entrypoint from Gecko into Gaia.

Does this sound feasible? Are there any previous experiments that I
could refer to?

Well, there is always profiling.
https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler

But this all depends on what kind of data you want to get.



-Olli




Thanks!
Freddy


[1] I intend to run the full test suite, not in production or anything.


_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to