SlideShare una empresa de Scribd logo
1 de 46
Optimizing
                 Perceived Performance
Monday, March 23, 2009
About Me



Monday, March 23, 2009
My Startup



Monday, March 23, 2009
DBDB



Monday, March 23, 2009
http://github.com/
                              dce/dbdb


Monday, March 23, 2009
http://github.com/
                              dce/dbdb
                          public/javascripts/application.js


Monday, March 23, 2009
def bagfactor
                      sleep(2)
                      rand(50) / 10.0
                    end

Monday, March 23, 2009
It could happen
                              to you


Monday, March 23, 2009
First Impressions



Monday, March 23, 2009
Up to...

     0.1 second          instantaneous
     1 second            responsive
     10 seconds          slow
     > 10 seconds        gone
                            – About Face 3


Monday, March 23, 2009
Bring in the AJAX



Monday, March 23, 2009
Some
                         Definitions


Monday, March 23, 2009
Progressive
                         Enhancement


Monday, March 23, 2009
Unobtrusive
                          Javascript


Monday, March 23, 2009
HIJAX


Monday, March 23, 2009
jQuery



Monday, March 23, 2009
class DbsController < ApplicationController
      def show
        @db = Db.find(params[:id])
        respond_to do |format|
          format.html
          format.js do
            render :partial => quot;profilequot;, :locals => { :db => @db }
          end
        end
      end
    end




Monday, March 23, 2009
$(quot;.db-list aquot;).click(function() {
                       link = $(this);
                       $.ajax({url: $(this).attr(quot;hrefquot;),
                         success: function(src) {
                           link.parents(quot;dtquot;).after(src);
                           link.unbind('click').click(function() {
                              $(this).parents(quot;dtquot;).next(quot;ddquot;).toggle();
                              return false;
                           })
                         }
                       });
                       return false;
                     });




Monday, March 23, 2009
Make It Snappy



Monday, March 23, 2009
$(quot;.db-list aquot;).click(function() {
            link = $(this);
            link.parents(quot;dtquot;).after('<dd class=quot;spinnerquot;></dd>');

              link.unbind(quot;clickquot;).click(function() {
                link.parents(quot;dtquot;).next(quot;ddquot;).slideToggle();
                return false;
              });

            $.ajax({url: link.attr(quot;hrefquot;),
              success: function(src) {
                link.parents(quot;dtquot;).next(quot;ddquot;).replaceWith(src);
              }
            });
            return false;
          });




Monday, March 23, 2009
Take Advantage
                           of Downtime


Monday, March 23, 2009
Monday, March 23, 2009
$(quot;.db-list aquot;).each(function() {
            $(this).parents(quot;dtquot;).after(quot;<dd class=quot;spinnerquot;></dd>quot;)
              .next(quot;ddquot;).hide();
          });

          $(quot;.db-list aquot;).click(function() {
            $(this).parents(quot;dtquot;).next(quot;ddquot;).slideToggle();
            return false;
          });

          $(quot;.db-list a:firstquot;).each(function() {
            $(this).loadContentInOrder();
          });




Monday, March 23, 2009
jQuery.fn.loadContentInOrder = function() {
            link = this;
            $.ajax({url: this.attr(quot;hrefquot;),
              success: function(src) {
                link.parents(quot;dtquot;).next(quot;ddquot;).replaceWith(src).next(quot;dtquot;)
                  .find(quot;aquot;).loadContentInOrder();
              }
            });
         };




Monday, March 23, 2009
Isolate Bottlenecks



Monday, March 23, 2009
Monday, March 23, 2009
JSON



Monday, March 23, 2009
{ quot;dbquot;: {
         quot;idquot;: 13,
         quot;namequot;: quot;Tyler Hansbroughquot;,
         quot;occupationquot;: quot;UNC Basketball Playerquot;,
         quot;bagfactorquot;: 1.3,
         quot;avatar_idquot;: 61
       }
     }




Monday, March 23, 2009
class DbsController < ApplicationController
     def show
       @db = Db.find(params[:id])
       respond_to do |format|
         format.html
         format.js { ... }
         format.json do
           render :json => { :bagfactor => @db.bagfactor }
         end
       end
     end
   end




Monday, March 23, 2009
$(quot;img.spinner:firstquot;).each(function() {
         $(this).loadBagfactor();
       });

       jQuery.fn.loadBagfactor = function() {
          img = this;
          $.ajax({url: this.parents(quot;ddquot;).prev(quot;dtquot;)
              .find(quot;aquot;).attr(quot;hrefquot;),
            data: { format: quot;jsonquot; }, dataType: quot;jsonquot;,
            success: function(db) {
              img.replaceWith(db.bagfactor);
              $(quot;img.spinner:firstquot;).loadBagfactor();
            }
          });
       };


Monday, March 23, 2009
The best solution?



Monday, March 23, 2009
The worst solution?



Monday, March 23, 2009
New Problem



Monday, March 23, 2009
PYTHONISTAS
                            It's my way or f--k you.



Monday, March 23, 2009
Remove Blocking
                           Operations


Monday, March 23, 2009
The Usual Way

           •Hidden iFrame
           •Second form w/ iFrame as
            target
           •Server sends back JS to
            update page
Monday, March 23, 2009
Something
                         Sorta Nuts


Monday, March 23, 2009
$(quot;a#ajax-uploadsquot;).click(function() {
             $(quot;input[type=file]quot;).replaceWith(
               '<iframe src=quot;/avatars/newquot;></iframe>');
             return false;
           });




Monday, March 23, 2009
<% form_for @avatar, :html => { :multipart => true } do |f| %>
        <%= f.file_field :image %>
      <% end %>

      <% javascript_tag do %>
        $(quot;inputquot;).change(function() {
          $(this).hide().after('<%= image_tag quot;spinner.gifquot; %>')
            .parents('form').submit();
        });
      <% end %>




Monday, March 23, 2009
<%= image_tag @avatar.image.url(:thumb) %>

            <% javascript_tag do %>
              $(quot;formquot;, top.document).append(
                '<%= hidden_field_tag quot;db[avatar_id]quot;, @avatar.id %>');
            <% end %>




Monday, March 23, 2009
Cool? Lame?



Monday, March 23, 2009
Conclusion



Monday, March 23, 2009
Consider perceived
                           performance


Monday, March 23, 2009
Write your own JS



Monday, March 23, 2009
Thank You
                         http://speakerrate.com/events/64




Monday, March 23, 2009
Questions?



Monday, March 23, 2009

Más contenido relacionado

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Destacado

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Optimizing Perceived Performance

Notas del editor