diff --git a/README.md b/README.md index 4f6bc75c0c8..8ddc3e6b830 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,59 @@ ## 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](https://www.udacity.com/course/ud884). +I was tasked with optimizing 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 I picked up in the [Critical Rendering Path course](https://www.udacity.com/course/ud884). + + To get started, check out the repository and inspect the code. -### Getting started #### Part 1: Optimize PageSpeed Insights score for index.html -Some useful tips to help you get started: +Website Location: -1. Check out the repository -1. To inspect the site on your phone, you can run a local server +PageSpeed Insights Scores: +1- Desktop: +2- Mobile: - ```bash - $> cd /path/to/your-project-folder - $> python -m SimpleHTTPServer 8080 - ``` +Changes Made to Attain these Scores: +Index.html + WITHIN THE HEAD TAG: + Added: + - meta tag for caching capability + - media attribute to link tage for print.css + - minified and inline critical css to reduce # of requests + + Removed: + - link tag for style.css to reduce # of requests + - call to google api for font + - all non manipulating js - to unblock DOM construction -1. Open a browser and visit localhost:8080 -1. Download and install [ngrok](https://ngrok.com/) to the top-level of your project directory to make your local server accessible remotely. + WITHIN THE BODY TAG: + Added: + - Compressed two(2) images [pizzeria.jpg and profilepic.jpg] - ``` bash - $> cd /path/to/your-project-folder - $> ./ngrok http 8080 - ``` + WITHIN THE HTML TAG: + Added: + - moved script tags from head tag; placed them after body tag therefore would not block DOM construction + - moved call to google api for font from head tag; used javascript to retrieve font; utilized the load function + - added async attribute to non manipulating js - -1. Copy the public URL ngrok gives you and try running it through PageSpeed Insights! Optional: [More on integrating ngrok, Grunt and PageSpeed.](http://www.jamescryer.com/2014/06/12/grunt-pagespeed-and-ngrok-locally-testing/) - -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](https://developer.chrome.com/devtools/docs/tips-and-tricks). - -### Optimization Tips and Tricks -* [Optimizing Performance](https://developers.google.com/web/fundamentals/performance/ "web performance") -* [Analyzing the Critical Rendering Path](https://developers.google.com/web/fundamentals/performance/critical-rendering-path/analyzing-crp.html "analyzing crp") -* [Optimizing the Critical Rendering Path](https://developers.google.com/web/fundamentals/performance/critical-rendering-path/optimizing-critical-rendering-path.html "optimize the crp!") -* [Avoiding Rendering Blocking CSS](https://developers.google.com/web/fundamentals/performance/critical-rendering-path/render-blocking-css.html "render blocking css") -* [Optimizing JavaScript](https://developers.google.com/web/fundamentals/performance/critical-rendering-path/adding-interactivity-with-javascript.html "javascript") -* [Measuring with Navigation Timing](https://developers.google.com/web/fundamentals/performance/critical-rendering-path/measure-crp.html "nav timing api"). We didn't cover the Navigation Timing API in the first two lessons but it's an incredibly useful tool for automated page profiling. I highly recommend reading. -* The fewer the downloads, the better -* Reduce the size of text -* Optimize images -* HTTP caching - -### 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. - -* Bootstrap's CSS Classes -* Bootstrap's Components +Website Location: + +Changes Made: +pizza.html + - Compressed two(2) images [pizzeria.jpg and pizza.png] + +main.js + - Update function changeSliderLabel() and determineDx () + To use documnet.getElementById instead of document.querySelector because it's more efficient accessing the DOM + - Update changePizzaSizes() to help avoid forced synchronous layout bottle necking + To use documnet.getElementsByClassName & is more efficient accessing the DOM instead of document.querySelector + Moved reading layout properties outside of the loop and batch update the styling afterwards + - Update function updatePositions() + To use document.getElementsByClassName('mover') is more efficient accessing the DOM instead of instead of querySelectorAll(.'mover') + Moved all code reading layout property 'scrollTop' outside of the loop and batch update the styling afterwards + Reduced the number of pizza images appended to 25 diff --git a/img/profilepic.jpg b/img/profilepic.jpg index 855172dd836..2ed5075e346 100644 Binary files a/img/profilepic.jpg and b/img/profilepic.jpg differ diff --git a/img/profilepic1.jpg b/img/profilepic1.jpg new file mode 100644 index 00000000000..855172dd836 Binary files /dev/null and b/img/profilepic1.jpg differ diff --git a/index.html b/index.html index 01ebf055996..137af902abf 100644 --- a/index.html +++ b/index.html @@ -5,30 +5,22 @@ -
Cameron Pittman
Course Developer
Akim George
FrontEnd Web Developer
Who wants a performant pizza?