Documente Academic
Documente Profesional
Documente Cultură
Bob Buffone
http://www.rockstarapps.com
Agenda
Copyright http://www.rockstarapps.com 2
What’s Happened to Websites?
Increase Revenue
• Improving page loading times increases conversions, ad
revenue…
• Many studies in this area all point to the same thing; the
faster your Website loads, the more money you will make.
Decrease hosting fees
• Web hosting and CDN services charge for bits and bytes
which means decreasing the bytes decreases the cost.
• CDNs like Amazon CloudFront also charge for the number of
requests.
• Deceasing the number of requests decreases the
infrastructure needed to run your Website.
Increase Users Experience
• Less waiting for sites to load means your users a much
happier
• The farther people are away from the production server the
longer they need to wait. Copyright http://www.rockstarapps.com 4
How do I know if I have a problem
with performance?
Open Source / Free tools – Great for debugging
issues with front-end Web performance.
• YSlow – This is a plugin for Firefox
• WebPagetest – Free online to that give you site
performance information.
• Google Page Speed - Plugin to firefox
Commercial – Provide continual monitoring of
Website performance.
• Keynote Systems
• Gomez
• BrowserMob
Copyright http://www.rockstarapps.com 5
How do I fix my issues?
Copyright http://www.rockstarapps.com 6
Reducing # of Requests
Copyright http://www.rockstarapps.com 7
The process is simple…
jquery.js
Bundling
plugin.js code.all.js
Process
mycode.js
Copyright http://www.rockstarapps.com 8
…it’s deciding how and when that’s
tough
Only two choices for when to do it:
• Runtime
• Development
Multiple choice for how
• Ant
• Server code
• Dojo
• Command line
• IDE Support?
•…
Copyright http://www.rockstarapps.com 9
Using server-side code to do the
concatenation
Goal is to make one request for all the
JavaScript
<head>
<script src=“jquery.js”></script>
<script src=“plugin.js”></script>
<script src=“mycode.js”></script>
</head>
Becomes
<head>
<script src=“combiner.php”></script>
</head>
Copyright http://www.rockstarapps.com 10
Reducing Size of Requests
How do I do that?
• Remove whitespace and comments
• Remove EOL characters
• Shrink variable and function parameter names
• GZIP
code.all.js Compression
code.all.min.js
Process
Copyright http://www.rockstarapps.com 11
Compression Tools
jsMin
Dean Edward’s Packer
Dojo Shrinksafe
YUI Compressor
Google has a new compression tool
RockstarApps Eclipse Plugin
Copyright http://www.rockstarapps.com 12
Be careful removing EOLs
X=10 Compression
Process X=10Y=“Bob”
Y=“Bob”
Copyright http://www.rockstarapps.com 13
Be careful removing EOLs
X=10; Compression
Process X=10;Y=“Bob”;
Y=“Bob”;
Copyright http://www.rockstarapps.com 14
GZIP Compression
Pluses
• Dramatically reduces size of file
• 330KB to 70KB
• Simple to do
• Lots of gzip tools
Minuses
• Lots of browser caveats
Copyright http://www.rockstarapps.com 15
Why did I build the RockstarApps
Tools?
Copyright http://www.rockstarapps.com 16
RockstarApps - A better solution
Copyright http://www.rockstarapps.com 17
RockstarApps Compressing files in
Aptana
www.rockstarapps.com
Copyright http://www.rockstarapps.com 18
Other Items
Copyright http://www.rockstarapps.com 20