4. Why bother?
Less CPU power and memory than
on the desktop
Slower connections
25Kb cache limit per file on iPhone
Source: http://yuiblog.com/blog/2008/02/06/iphone-cacheability/
18. Maximising parallel downloads
LABjs “all-purpose, on-demand
JavaScript loader, capable of loading any
JavaScript resource, from any location,
into any page, at any time.”
Allows to load scripts in parallel
http://labjs.com/
37. Reflows
Reflow occurs when the DOM is
manipulated in a way it affects the
layout. E.g. style is changed to affect the
layout, className property is changed or
browser window is resized.
Reflows are even more expensive than
repainting.
39. Reflows are triggered by
Style is changed that affects the layout
className property of an element is changed
DOM modifications (e.g. adding new
elements)
using offsetWidth / offsetHeight /
getComputedStyle
44. Underlying Problem of Single
Thread
UI rendering & JavaScript share the
same thread of execution
Longrunning scripts can freeze UI or
cause 'Do you want to stop this script'
prompts
65. Sizzle selector engine
●
Introduced in jQuery 1.3
● http://sizzlejs.com/
●
Unlike earlier versions of
jQuery, it parses selectors from
right to left
●
This is how browsers parse
CSS too
79. Google Closure Compiler
Opensource, written in Java & easy to extend
Three modes
Up to 6070% filesize savings
Advanced code transforms based on syntax tree
including constant & function inlining, dead code
removal etc.
Highlights code patterns that may not work well on
all browsers
jQuery gained 13% minification improvement by
switiching to Google Compiler from YUI compressor