Skip to content

pmdida/P4-Brower-Rendering-Optimization

 
 

Repository files navigation

Optimizations made

Critical rendering path of index.html

  • pizzeria.jpg
    • From 2048px to 120px and copied to /img/
    • Size: from 2370 kB to 18kB
    • Mobile speed: 28/100 -> 76/100
  • pizzeria.jpg and profilepic.jpg as .webp images
    • Mobile speed: 76/100 -> 75/100
  • Compress images in img
    • 75/100 -> 77/100
  • Asynchronous google analytics
    • 77/100 -> 77/100
  • Minify css and add media="print" to print.css
    • 77/100 -> 77/100
  • Remove google font query
    • 77/100 -> 84/100
  • Minify html, inline css:
    • 84/100 -> 94/100

Timeline of pizza.html

  • Improvements to resizePizzas():
    • Avoid layout trashing when resizing pizzas
    • Time to resize pizzas: 173 ms -> 1.5 ms
  • Improvements to updatePositions():
    • Number of background pizzas generated depends on window size (much less than 200)
    • Phases calculated only once per updatePositions
    • Pizzas are moved with transform instead of left
    • Average time for 10 frames: 30 ms -> 0.3 ms

See comments in views/js/main.js

Website Performance Optimization portfolio project

Your challenge, if you wish to accept it (and we sure hope you will), is to optimize this online portfolio for speed! In particular, optimize the critical rendering path and make this page render as quickly as possible by applying the techniques you've picked up in the Critical Rendering Path course.

To get started, check out the repository, inspect the code,

Getting started

####Part 1: Optimize PageSpeed Insights score for index.html

Some useful tips to help you get started:

  1. Check out the repository
  2. To inspect the site on your phone, you can run a local server
$> cd /path/to/your-project-folder
$> python -m SimpleHTTPServer 8080
  1. Open a browser and visit localhost:8080
  2. Download and install ngrok to make your local server accessible remotely.
$> cd /path/to/your-project-folder
$> ngrok 8080
  1. Copy the public URL ngrok gives you and try running it through PageSpeed Insights! Optional: More on integrating ngrok, Grunt and PageSpeed.

Profile, optimize, measure... and then lather, rinse, and repeat. Good luck!

####Part 2: Optimize Frames per Second in pizza.html

To optimize views/pizza.html, you will need to modify views/js/main.js until your frames per second rate is 60 fps or higher. You will find instructive comments in main.js.

You might find the FPS Counter/HUD Display useful in Chrome developer tools described here: Chrome Dev Tools tips-and-tricks.

Optimization Tips and Tricks

Customization with Bootstrap

The portfolio was built on Twitter's Bootstrap framework. All custom styles are in dist/css/portfolio.css in the portfolio repo.

Sample Portfolios

Feeling uninspired by the portfolio? Here's a list of cool portfolios I found after a few minutes of Googling.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 50.1%
  • HTML 44.8%
  • CSS 5.1%