Thanks for all the links, these are great :) I'll update my presentation quoting you, if you don't mind. I believe that it would be a great topic for a book - comparison of advanced features of browser engines. It could even be ridiculously overpriced, like the ISO C++11 standard. I'd love to sell my kidney and buy something like that.
Sebastian On 9 Gru, 17:12, Rob Brackett <[email protected]> wrote: > Good questions! > > On Fri, Dec 9, 2011 at 7:22 AM, Sebastian Poręba <[email protected] > > > wrote: > > Is there any place where I can track progress on > > things like JIT, GC or reflow and repaint process? > > I don't know of any great place to track these specific things. Peter > Beverloo (http://peter.sh/) blogs weekly about all the major changes that > have gone into WebKit and Chromium, but focuses much more on other features > than the actual JS engine. You'll occasionally see some notes about > JavaScriptCore and V8 there, though. I don't know of anything similar for > Firefox. > > > * is reflow blocking and if yes - were there any attempts to move it > > to a separated thread? I understand why it would be hard or even > > impossible - reflow in the background could be obsolete before it's > > even finished, but was it considered or tested? > > It is blocking—the main problem (as far as I am aware) is that there are a > number of DOM methods and properties (e.g. offsetWidth, > getComputedStyle()), that require all rendering and reflow to be done in > order to return a valid response. > > This blog post has a nice list of those > properties:http://gent.ilcore.com/2011/03/how-not-to-trigger-layout-in-webkit.html > > > * what are the exact types that are JITed? If jQuery-like config > > object is passed to a function, can it be compiled? What about arrays > > and strings? > > This depends a lot on the JavaScript engine. All of them JIT differently > and with their own special rules, though there are some commonalities. > There are also different levels of JIT-ing :) > > Some quick pointers based on the things you mentioned in your questions, > though: > > Passing config objects to functions can often cause them to run slower—most > engines use a concept of "shape" to JIT code related to objects (shape is > basically the set of keys on your object, so {a:"a", b:"b"} and {a:"c", > b:"d"} are the same shape but {a:"a", c:"b"} is a different shape). The > function will generally have to be JITed once for each shape that is passed > in. Some engines stop re-JITing after they've seen a certain number of > shapes (the threshold is different for different engines) and some do not. > > With arrays, you'll usually get the best performance by not adding any > non-numeric properties (i.e. don't do "someArray.someProperty = 5") and by > not having sparse arrays (arrays that aren't filled in continuously, such > as "var myArray = []; myArray[0] = 5; myArray[100] = 5;"). To stay safe > with arrays, it's usually best to only use push() or unshift() to add > values. If you can support just newer browsers, you can get even better by > using typed arrays where possible (e.g. Int16Array). > > I don't know any great resources for this stuff. I think I have learned > most of it from going to presentations (you can find some good ones > searching google), talking with people who work on WebKit, and reading code > :( > > > * how long is the minimal delay between reflows? > > Reflows are entirely triggered by your code (JS DOM methods and CSS). > Usually, reflows will not happen until the end of an event loop, but you > can trigger them by querying for those properties I mentioned above. > > It's also good to note that not all repaints are also reflows. Depending on > what properties you change (generally just those that cannot affect layout, > such as background-color), only a repaint may be necessary (still > expensive, but nearly as bad as a reflow). > > > * is there any way to debug JIT? to check if or when function was > > compiled? > > None that I am aware of. I was at a recent presentation by Dave Mandelin, > who works on JS in Firefox, and he mentioned that they are aware of the > issue and playing with some ideas for tools, but nothing is there yet. You > should file bugs on WebKit and Chromium—filing bugs really does help :) > > > * what are the differences in method JIT between FF and Chrome? > > Many. This is a really complex topic and I haven't found a solid overview > anywhere, so your best bet is spending a lot of time with Google and > reading lots of articles about specific parts of each of the engines. > > > I'm not a please-explain-me-slowly type of guy, so any link to a blog > > post or a book/documentation would be enough for me. It's just that > > finding something about these topics turned out to be impossible for > > me. I've seen few presentations about that on slideshare, I wonder if > > they were given only by people who worked on browser engines. > > Dave Mandelin, who works on Firefox's JS implementation, has given a few. > I'm not sure of any others who work on V8 or JavaScriptCore that present > much, though. > > Hope some of that helps! > > -Rob -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
