As part of Udacity's Critical Rendering Path course my challenge was 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 shown during the course.
This is the link to the optimized version of the site: https://ronalson.github.io/udportfolio/
- Clone the repository
$ git clone git@github.com:ronalson/udportfolio.git- Server the website:
Using Python
$ python -m SimpleHTTPServeror using Atom Live Server Package
- Open the website:
$ open "http://localhost:8000"- Critical Rendering Path - Get
index.htmlachieves a PageSpeed score of at least 90 for Mobile and Desktop.
- Reorganizing HTML @ index.html
- add
media="print"toprint.cssto reduce render blocking <script>tags set to the bottom and addasyncattribute
- Image Optimization
- Apply corps and resizes to avoid unnecessary pixel rendering
- Run images through optimization tool TinyPNG
-
Frame Rate - Optimizations made to
views/js/main.jsmakeviews/pizza.htmlrender with a consistent frame-rate at 60fps when scrolling. -
- Computational Efficiency - Time to resize pizzas is less than 5 ms using the pizza size slider on the
views/pizza.htmlpage. Resize time is shown in the browser developer tools.
- Image Optimization
- Apply corps and resizes to avoid unnecessary pixel rendering
- Run images through optimization tool TinyPNG
- Use responsive image techniques (i.e.
srcset)
- Fix
changePizzaSizes()function
- Remove repetitions
- Remove unnecessary pixel creation from
determineDxfunction - Remove DOM querying from inside the
forloop
- Fix
updatePositions()function
- Remove DOM geometry calculation from inside the
forloop - Use CSS translate to move pizza instead of position.
- Add
will-change: transform;to.moveclass
- Event Listener
- call
updatePositionswithrequestAnimationFrameon scrolling - call
updatePositionswithrequestAnimationFrameon documentLoaded
- Reduce number of pizza sliding