SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
http://www.flickr.com/photos/chavals/3045853162/




      delivering a
      responsive ui
      rebecca murphey • refresh the triangle • march 2010

Thursday, March 25, 2010
Thursday, March 25, 2010
“... a lot of people within Google think that the web should be fast. It should be
        a good experience, and so it’s sort of fair to say that if
                                               you’re a fast
        site, maybe you should get a little bit of a bonus. If you
        really have an awfully slow site, then maybe users don’t want that as much.”

                                                                        — Matt Cutts, Google




Thursday, March 25, 2010
10s intolerable




                                              Amazon Home Page (5.43s)




   Google Results Page (942ms)
 Google Home Page (745ms)              1s responsive

                           100ms instantaneous
Thursday, March 25, 2010
what slows
     sites down?
     (hint: it’s not the server)




Thursday, March 25, 2010
e top 10 websites spend less than
       20% of total response time retrieving
       the HTML document.
                           — “High Performance Web Sites”, Steve Souders




Thursday, March 25, 2010
Thursday, March 25, 2010
load your resources
      in the right order
                           http://www.flickr.com/photos/btsunami/1204911091/

Thursday, March 25, 2010
<!DOCTYPE html>
      <html>
      <head>
          <meta charset="utf-8">
          <title>Delivering a Responsive UI</title>

          <link rel="stylesheet" href="css/html5reset.css" type="text/css" media="screen" charset="utf-8">
          <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" charset="utf-8">

          <script   src="js/jquery.js"></script>
          <script   src="js/jquery.blockui.js"></script>
          <script   src="js/jquery.cycle.js"></script>
          <script   src="js/jquery.validate.js"></script>
          <script   src="js/app.js"></script>

      </head>
      <body>
                <ul id="banner">
                    <li class="news"><strong>News:</strong> Your website can be faster!</li>
                </ul>

                <div id="wrapper">

                <section id="mainbar">
                    <section id="content">
                        <header>
                            <h1>Delivering a Responsive UI</h1>
                        </header>

                        <img src="img/speed.jpg" alt="http://www.flickr.com/photos/chavals/3045853162/">

                      <p class="intro">Your visitors deserve a fast site; thankfully, with just a little bit of
      effort, you can provide a responsive experience. Here&rsquo;s why you need to care:</p>

                        <ul>
                              <li>&ldquo;&hellip; a lot of people within   Google think that the web should be fast. It
        should be a good experience, and so it’s sort of fair to say     that <strong>if you&rsquo;re a fast site, maybe
        you should get a little bit of a bonus</strong>. If you really     have an awfully slow site, then maybe users donâ
        €™t want that as much.&rdquo; &mdash Matt Cutts, Google</li>
                              <li>&ldquo;&hellip; the iPhone browser was   able to cache a maximum of <strong>19 external
Thursday, Marchcomponents</strong>.&rdquo;</li>
        25KB 25, 2010
<!DOCTYPE html>
        <html>
        <head>
            <meta charset="utf-8">
            <title>Delivering a Responsive UI</title>

             <link rel="stylesheet" href="css/html5reset.css" type="text/css" media="screen" charset="utf-8">
             <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" charset="utf-8">

              <script      src="js/jquery.js"></script>
              <script      src="js/jquery.blockui.js"></script>
              <script      src="js/jquery.cycle.js"></script>
              <script
Thursday, March 25, 2010   src="js/jquery.validate.js"></script>
your .htaccess file:
                            </p>
                            <pre>
        RewriteCond %{REQUEST_URI} ^/v/[0-9.]+/
        RewriteRule ^v/[0-9.]+/(.*) /$1
                            </pre>
                            <p>
                                 Then, set the version number in a config file, and change it as needed; when the
        version number changes, the browser will automatically fetch the resource, because it will see it as a resource
        it has never seen before.
                            </p>
                        </article>

                       </section>
                   </section>

                   <section id="promos">
                       <article id="social">
                           <ul>
                                <a href="http://pinboard.in/u:rmurphey/t:responsive-ui/"><li class="pinboard">Pinboard</
        li></a>
                               <a     href="http://twitter.com/rmurphey"><li class="twitter">Twitter</li></a>
                               <a     href="http://linkedin.com/rmurphey"><li class="linkedin">LinkedIn</li></a>
                               <a     href="http://vimeo.com/yayquery"><li class="vimeo">Vimeo</li></a>
                               <a     href="http://slideshare.net/rmurphey"><li class="slideshare">Slideshare</li></a>
                               <a     href="http://flickr.com/photos/rdmey"><li class="flickr">Flickr</li></a>
                           </ul>
                       </article>
                   </section>
                   </div>

             <script       src="js/jquery.js"></script>
             <script       src="js/jquery.blockui.js"></script>
             <script       src="js/jquery.cycle.js"></script>
             <script       src="js/jquery.validate.js"></script>
             <script       src="js/app.js"></script>

        </body>
        </html>




Thursday, March 25, 2010
</article>
                   </section>
                   </div>

             <script       src="js/jquery.js"></script>
             <script       src="js/jquery.blockui.js"></script>
             <script       src="js/jquery.cycle.js"></script>
             <script       src="js/jquery.validate.js"></script>
             <script       src="js/app.js"></script>

        </body>
        </html>




Thursday, March 25, 2010
combine & minify
      your resources
Thursday, March 25, 2010
combine & minify css
        # combine css into one file
        cat html5reset.css styles.css > tmp.css;

        # run yui compressor over the combined file
        java -jar ~/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar --type css tmp.css >
        prod.css;

        # remove the tmp file you created
        rm tmp.css;




      combine & minify js
        # combine all of the files that aren't likely to change into one file
        cat jquery.js jquery.blockui.js jquery.cycle.js jquery.validate.js > tmp.js;

        # run yui compressor over the combined file




                                                                                              sprites
        java -jar ~/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar tmp.js > prod.min.js;

        # run yui compressor over your app file
        java -jar ~/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar app.js > app.min.js;

        # remove the tmp file you created
        rm tmp.js;




Thursday, March 25, 2010
Thursday, March 25, 2010
<script src="js/LAB.min.js"></script>
                           <script>
                           $LAB
                                .script('js/prod.min.js')
                                .wait()
                                .script('js/app.min.js');
                           </script>

                           <!-- <script src="js/prod.min.js"></script>
                           <script src="js/app.min.js"></script> -->




Thursday, March 25, 2010
http://www.flickr.com/photos/vetustense/3838462120/




      allow for caching
      ... and cachebusting
Thursday, March 25, 2010
# .htaccess
          ExpiresActive On
          ExpiresDefault "access plus 480 weeks"
          ExpiresByType image/gif "access plus 5 hours"

          Header set Cache-Control "max-age=290304000, public"




       expiration &
       cache control
Thursday, March 25, 2010
# .htaccess
          RewriteCond %{REQUEST_URI} ^/v/[0-9.]+/
          RewriteRule ^v/[0-9.]+/(.*) /$1




       cachebusting via
       URL versioning
       http://www.rebeccamurphey.com/v/1234/responsive-ui/img/add.png

Thursday, March 25, 2010
http://www.flickr.com/photos/otterlove/3208353418/




     write faster
     javascript

Thursday, March 25, 2010
append all at once

            // BAD
            for (var i=0; i<10; i++) {
                $('body').append('<li>list item number ' + i + '</li>');
            }

            // BETTER
            var $body = $('body');
            for (var i=0; i<10; i++) {
                $body.append('<li>list item number ' + i + '</li>');
            }

            // BEST
            var html;

            for (var i=0; i<10; i++) {
                html += '<li>list item number ' + i + '</li>';
            }

            $('body').append(html);




Thursday, March 25, 2010
use good selectors & cache selections
            // BAD
            $('.foo').addClass('bar');
            $('.foo').append('<p>hello world</p>');
            $('.foo').css('color', 'red');
            $('.foo').css('border', '1px solid blue');

            // GOOD

            // use a better selector, and cache the selection
            var $foo = $('div.foo');

            // test selection length if the element may not exist
            if ($foo.length) {
                $foo
                     .addClass('bar')
                     .append('<p>hello world</p>')
                     .css({
                         color : 'red',
                         border : '1px solid blue'
                     });
            }




Thursday, March 25, 2010
optimize event binding
            // this is fine ...
            $('div.foo').bind('click', function(e) {
                alert('clicked');
            });

            // ... but this is faster!
            $('div.foo').bind('mousedown', function(e) {
                alert('clicked');
            });




Thursday, March 25, 2010
embrace modern
      browser features,
      over pixel perfection
Thursday, March 25, 2010
Thursday, March 25, 2010
Thursday, March 25, 2010
Thursday, March 25, 2010
Thursday, March 25, 2010
http://dowebsitesneedtobeexperiencedexactlythesameineverybrowser.com/




Thursday, March 25, 2010
consider performance
      early and often
Thursday, March 25, 2010
Thursday, March 25, 2010
thanks.


                blog.rebeccamurphey.com
                pinboard.in/u:rmurphey/t:responsive-ui/
                slideshare.net/rmurphey/responsive-ui/


Thursday, March 25, 2010

Mais conteúdo relacionado

Mais procurados

Mulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development ToolkitMulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development ToolkitRebecca Murphey
 
A New Baseline for Front-End Devs
A New Baseline for Front-End DevsA New Baseline for Front-End Devs
A New Baseline for Front-End DevsRebecca Murphey
 
Data20161007
Data20161007Data20161007
Data20161007capegmail
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j queryMd. Ziaul Haq
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScriptAndrew Dupont
 
Using Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeUsing Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeRebecca Murphey
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony AppsKris Wallsmith
 
jQuery Namespace Pattern
jQuery Namespace PatternjQuery Namespace Pattern
jQuery Namespace PatternDiego Fleury
 
Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»e-Legion
 
Introduction to ECMAScript 2015
Introduction to ECMAScript 2015Introduction to ECMAScript 2015
Introduction to ECMAScript 2015Tomasz Dziuda
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 
Recent Changes to jQuery's Internals
Recent Changes to jQuery's InternalsRecent Changes to jQuery's Internals
Recent Changes to jQuery's Internalsjeresig
 
Special Events: Beyond Custom Events
Special Events: Beyond Custom EventsSpecial Events: Beyond Custom Events
Special Events: Beyond Custom EventsBrandon Aaron
 

Mais procurados (20)

Mulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development ToolkitMulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development Toolkit
 
Dojo Confessions
Dojo ConfessionsDojo Confessions
Dojo Confessions
 
Bacbkone js
Bacbkone jsBacbkone js
Bacbkone js
 
A New Baseline for Front-End Devs
A New Baseline for Front-End DevsA New Baseline for Front-End Devs
A New Baseline for Front-End Devs
 
Data20161007
Data20161007Data20161007
Data20161007
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
Using Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeUsing Objects to Organize your jQuery Code
Using Objects to Organize your jQuery Code
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
jQuery Namespace Pattern
jQuery Namespace PatternjQuery Namespace Pattern
jQuery Namespace Pattern
 
course js day 3
course js day 3course js day 3
course js day 3
 
Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»
 
jQuery
jQueryjQuery
jQuery
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Introduction to ECMAScript 2015
Introduction to ECMAScript 2015Introduction to ECMAScript 2015
Introduction to ECMAScript 2015
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
Recent Changes to jQuery's Internals
Recent Changes to jQuery's InternalsRecent Changes to jQuery's Internals
Recent Changes to jQuery's Internals
 
Matters of State
Matters of StateMatters of State
Matters of State
 
J query training
J query trainingJ query training
J query training
 
Special Events: Beyond Custom Events
Special Events: Beyond Custom EventsSpecial Events: Beyond Custom Events
Special Events: Beyond Custom Events
 

Semelhante a Delivering a Responsive UI

#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
 
Web Performance Optimierung - DWX13
Web Performance Optimierung - DWX13Web Performance Optimierung - DWX13
Web Performance Optimierung - DWX13Walter Ebert
 
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tablesWeb Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tablesAl-Mamun Sarkar
 
Faster Frontends
Faster FrontendsFaster Frontends
Faster FrontendsAndy Davies
 
Webpack packing it all
Webpack packing it allWebpack packing it all
Webpack packing it allCriciúma Dev
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowDerek Willian Stavis
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and ImprovedTimothy Fisher
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićMeetMagentoNY2014
 
Desenvolvimento web com jQuery Mobile
Desenvolvimento web com jQuery MobileDesenvolvimento web com jQuery Mobile
Desenvolvimento web com jQuery MobilePablo Garrido
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizationsChris Love
 
Enough with the JavaScript already!
Enough with the JavaScript already!Enough with the JavaScript already!
Enough with the JavaScript already!Nicholas Zakas
 
Web Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesWeb Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesSteve Souders
 
Design+Performance Velocity 2015
Design+Performance Velocity 2015Design+Performance Velocity 2015
Design+Performance Velocity 2015Steve Souders
 
Enough with the javas cript already! de Nicholas Zakas
Enough with the javas cript already! de Nicholas ZakasEnough with the javas cript already! de Nicholas Zakas
Enough with the javas cript already! de Nicholas ZakasKubide
 

Semelhante a Delivering a Responsive UI (20)

#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Upload[1]
Upload[1]Upload[1]
Upload[1]
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
Web Performance Optimierung - DWX13
Web Performance Optimierung - DWX13Web Performance Optimierung - DWX13
Web Performance Optimierung - DWX13
 
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tablesWeb Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
 
The Devil and HTML5
The Devil and HTML5The Devil and HTML5
The Devil and HTML5
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Faster Frontends
Faster FrontendsFaster Frontends
Faster Frontends
 
Webpack packing it all
Webpack packing it allWebpack packing it all
Webpack packing it all
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to now
 
Web-Performance
Web-PerformanceWeb-Performance
Web-Performance
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje Jurišić
 
Desenvolvimento web com jQuery Mobile
Desenvolvimento web com jQuery MobileDesenvolvimento web com jQuery Mobile
Desenvolvimento web com jQuery Mobile
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
 
Enough with the JavaScript already!
Enough with the JavaScript already!Enough with the JavaScript already!
Enough with the JavaScript already!
 
Web Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesWeb Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web Sites
 
Design+Performance Velocity 2015
Design+Performance Velocity 2015Design+Performance Velocity 2015
Design+Performance Velocity 2015
 
Enough with the javas cript already! de Nicholas Zakas
Enough with the javas cript already! de Nicholas ZakasEnough with the javas cript already! de Nicholas Zakas
Enough with the javas cript already! de Nicholas Zakas
 
jQuery
jQueryjQuery
jQuery
 

Mais de Rebecca Murphey

Mais de Rebecca Murphey (7)

Getting Started with Mulberry
Getting Started with MulberryGetting Started with Mulberry
Getting Started with Mulberry
 
Introducing Mulberry
Introducing MulberryIntroducing Mulberry
Introducing Mulberry
 
DojoConf: Building Large Apps
DojoConf: Building Large AppsDojoConf: Building Large Apps
DojoConf: Building Large Apps
 
Lessons from-a-rewrite-gotham
Lessons from-a-rewrite-gothamLessons from-a-rewrite-gotham
Lessons from-a-rewrite-gotham
 
Lessons from a Rewrite
Lessons from a RewriteLessons from a Rewrite
Lessons from a Rewrite
 
Modern JavaScript
Modern JavaScriptModern JavaScript
Modern JavaScript
 
The jQuery Divide
The jQuery DivideThe jQuery Divide
The jQuery Divide
 

Último

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 

Último (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 

Delivering a Responsive UI

  • 1. http://www.flickr.com/photos/chavals/3045853162/ delivering a responsive ui rebecca murphey • refresh the triangle • march 2010 Thursday, March 25, 2010
  • 3. “... a lot of people within Google think that the web should be fast. It should be a good experience, and so it’s sort of fair to say that if you’re a fast site, maybe you should get a little bit of a bonus. If you really have an awfully slow site, then maybe users don’t want that as much.” — Matt Cutts, Google Thursday, March 25, 2010
  • 4. 10s intolerable Amazon Home Page (5.43s) Google Results Page (942ms) Google Home Page (745ms) 1s responsive 100ms instantaneous Thursday, March 25, 2010
  • 5. what slows sites down? (hint: it’s not the server) Thursday, March 25, 2010
  • 6. e top 10 websites spend less than 20% of total response time retrieving the HTML document. — “High Performance Web Sites”, Steve Souders Thursday, March 25, 2010
  • 8. load your resources in the right order http://www.flickr.com/photos/btsunami/1204911091/ Thursday, March 25, 2010
  • 9. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Delivering a Responsive UI</title> <link rel="stylesheet" href="css/html5reset.css" type="text/css" media="screen" charset="utf-8"> <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" charset="utf-8"> <script src="js/jquery.js"></script> <script src="js/jquery.blockui.js"></script> <script src="js/jquery.cycle.js"></script> <script src="js/jquery.validate.js"></script> <script src="js/app.js"></script> </head> <body> <ul id="banner"> <li class="news"><strong>News:</strong> Your website can be faster!</li> </ul> <div id="wrapper"> <section id="mainbar"> <section id="content"> <header> <h1>Delivering a Responsive UI</h1> </header> <img src="img/speed.jpg" alt="http://www.flickr.com/photos/chavals/3045853162/"> <p class="intro">Your visitors deserve a fast site; thankfully, with just a little bit of effort, you can provide a responsive experience. Here&rsquo;s why you need to care:</p> <ul> <li>&ldquo;&hellip; a lot of people within Google think that the web should be fast. It should be a good experience, and so it’s sort of fair to say that <strong>if you&rsquo;re a fast site, maybe you should get a little bit of a bonus</strong>. If you really have an awfully slow site, then maybe users donâ €™t want that as much.&rdquo; &mdash Matt Cutts, Google</li> <li>&ldquo;&hellip; the iPhone browser was able to cache a maximum of <strong>19 external Thursday, Marchcomponents</strong>.&rdquo;</li> 25KB 25, 2010
  • 10. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Delivering a Responsive UI</title> <link rel="stylesheet" href="css/html5reset.css" type="text/css" media="screen" charset="utf-8"> <link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" charset="utf-8"> <script src="js/jquery.js"></script> <script src="js/jquery.blockui.js"></script> <script src="js/jquery.cycle.js"></script> <script Thursday, March 25, 2010 src="js/jquery.validate.js"></script>
  • 11. your .htaccess file: </p> <pre> RewriteCond %{REQUEST_URI} ^/v/[0-9.]+/ RewriteRule ^v/[0-9.]+/(.*) /$1 </pre> <p> Then, set the version number in a config file, and change it as needed; when the version number changes, the browser will automatically fetch the resource, because it will see it as a resource it has never seen before. </p> </article> </section> </section> <section id="promos"> <article id="social"> <ul> <a href="http://pinboard.in/u:rmurphey/t:responsive-ui/"><li class="pinboard">Pinboard</ li></a> <a href="http://twitter.com/rmurphey"><li class="twitter">Twitter</li></a> <a href="http://linkedin.com/rmurphey"><li class="linkedin">LinkedIn</li></a> <a href="http://vimeo.com/yayquery"><li class="vimeo">Vimeo</li></a> <a href="http://slideshare.net/rmurphey"><li class="slideshare">Slideshare</li></a> <a href="http://flickr.com/photos/rdmey"><li class="flickr">Flickr</li></a> </ul> </article> </section> </div> <script src="js/jquery.js"></script> <script src="js/jquery.blockui.js"></script> <script src="js/jquery.cycle.js"></script> <script src="js/jquery.validate.js"></script> <script src="js/app.js"></script> </body> </html> Thursday, March 25, 2010
  • 12. </article> </section> </div> <script src="js/jquery.js"></script> <script src="js/jquery.blockui.js"></script> <script src="js/jquery.cycle.js"></script> <script src="js/jquery.validate.js"></script> <script src="js/app.js"></script> </body> </html> Thursday, March 25, 2010
  • 13. combine & minify your resources Thursday, March 25, 2010
  • 14. combine & minify css # combine css into one file cat html5reset.css styles.css > tmp.css; # run yui compressor over the combined file java -jar ~/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar --type css tmp.css > prod.css; # remove the tmp file you created rm tmp.css; combine & minify js # combine all of the files that aren't likely to change into one file cat jquery.js jquery.blockui.js jquery.cycle.js jquery.validate.js > tmp.js; # run yui compressor over the combined file sprites java -jar ~/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar tmp.js > prod.min.js; # run yui compressor over your app file java -jar ~/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar app.js > app.min.js; # remove the tmp file you created rm tmp.js; Thursday, March 25, 2010
  • 16. <script src="js/LAB.min.js"></script> <script> $LAB .script('js/prod.min.js') .wait() .script('js/app.min.js'); </script> <!-- <script src="js/prod.min.js"></script> <script src="js/app.min.js"></script> --> Thursday, March 25, 2010
  • 17. http://www.flickr.com/photos/vetustense/3838462120/ allow for caching ... and cachebusting Thursday, March 25, 2010
  • 18. # .htaccess ExpiresActive On ExpiresDefault "access plus 480 weeks" ExpiresByType image/gif "access plus 5 hours" Header set Cache-Control "max-age=290304000, public" expiration & cache control Thursday, March 25, 2010
  • 19. # .htaccess RewriteCond %{REQUEST_URI} ^/v/[0-9.]+/ RewriteRule ^v/[0-9.]+/(.*) /$1 cachebusting via URL versioning http://www.rebeccamurphey.com/v/1234/responsive-ui/img/add.png Thursday, March 25, 2010
  • 20. http://www.flickr.com/photos/otterlove/3208353418/ write faster javascript Thursday, March 25, 2010
  • 21. append all at once // BAD for (var i=0; i<10; i++) { $('body').append('<li>list item number ' + i + '</li>'); } // BETTER var $body = $('body'); for (var i=0; i<10; i++) { $body.append('<li>list item number ' + i + '</li>'); } // BEST var html; for (var i=0; i<10; i++) { html += '<li>list item number ' + i + '</li>'; } $('body').append(html); Thursday, March 25, 2010
  • 22. use good selectors & cache selections // BAD $('.foo').addClass('bar'); $('.foo').append('<p>hello world</p>'); $('.foo').css('color', 'red'); $('.foo').css('border', '1px solid blue'); // GOOD // use a better selector, and cache the selection var $foo = $('div.foo'); // test selection length if the element may not exist if ($foo.length) { $foo .addClass('bar') .append('<p>hello world</p>') .css({ color : 'red', border : '1px solid blue' }); } Thursday, March 25, 2010
  • 23. optimize event binding // this is fine ... $('div.foo').bind('click', function(e) { alert('clicked'); }); // ... but this is faster! $('div.foo').bind('mousedown', function(e) { alert('clicked'); }); Thursday, March 25, 2010
  • 24. embrace modern browser features, over pixel perfection Thursday, March 25, 2010
  • 30. consider performance early and often Thursday, March 25, 2010
  • 32. thanks. blog.rebeccamurphey.com pinboard.in/u:rmurphey/t:responsive-ui/ slideshare.net/rmurphey/responsive-ui/ Thursday, March 25, 2010