Code Monkey home page Code Monkey logo

frontend-p4-website-optimization's Introduction

Website Performance Optimization portfolio project

How to run

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

http://huylllooo.github.io/P4-Website-Optimization/

Copy the URL and running it through PageSpeed Insights!

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

Here's the url to test FPS

http://huylllooo.github.io/P4-Website-Optimization/views/pizza.html

Optimizations made

####1: CRP for index.html

Added fonts by JavaScript, then added 'async' attribute together with some other scripts(minimize the use of parser blocking resources).

Inlined minified-style.css, added media="print" for print.css.

Resized and compressed "views/images/pizzeria.jpg" by Grunt.

The page has scored 92-93 for mobile and desktop on PageSpeed Insights

####2: Framerate for pizza.html

Changed the number of moving-pizzas to 40(from 200), avoid drawing to much unnecessary pizzas.

Modified updatePositions() function:

Cached List of moving-pizzas.
Use getELementByClassName to get elements faster.
Avoided calculations in loop.
Used 'transform' to move pizza instead of 'left' (also edited pizza.html thanks to Safadurimo's solution for the problem using transform: https://discussions.udacity.com/t/replace-left-with-transform/20093).
Disable logAverageFrame() function.

####3: Computational Efficiency for pizza.html

Avoided calculations in loop.

Modified to calculate newWidth without calling another function.

Time to resize pizzas: ~ 1ms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.