Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Addy Osmani addyosmani

🎯
Focusing
Block or report user

Report or block addyosmani

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@addyosmani
addyosmani / scratchpad.md
Last active Oct 25, 2017
Webpack Performance Presets
View scratchpad.md

"We need Webpack presets" and "Webpack and its plugins are too hard to configure correctly" have been the number one cause of developer pain shared with me from large sites adopting Progressive Web Apps and optimising their load performance.

If I was building a Webpack preset pack for performance, I might use the following:

  • Ensure you're using a production build of your framework: new webpack.DefinePlugin({ 'process.env': env })
  • Minify your JS: webpack.optimize.UglifyJsPlugin
  • Compress your resources (GZip): compression-webpack-plugin
  • Split your vendor chunks: CommonsChunkPlugin
View v8-RCS-experiment.md
  1. Type chrome://flags into your browser
  2. Scroll down to “Enable Developer Tools experiments” and click enable
  3. Restart Chrome
  4. Open up DevTools
  5. Click on the gear icon — it’s typically on the top right or bottom right
  6. Select experiments from the menu on the left
  7. Hit shift 6 times to show hidden experiments
  8. Enable 'V8 Runtime Call Stats on Timeline'

We are hoping to turn this feature on by default soon so the above steps are not needed.

View top10k.txt
google.com
facebook.com
youtube.com
baidu.com
amazon.com
yahoo.com
wikipedia.org
qq.com
twitter.com
google.co.in
@addyosmani
addyosmani / preprocessing.md
Last active Jan 25, 2019
JavaScript preprocessing/precompilation
View preprocessing.md

Problem: How can we preprocess JavaScript (at build-time or on the server-side) so engines like V8 don't have to spend as much time in Parse? This is a topic that involves generating either bytecode or a bytecode-like-abstraction that an engine would need to accept. For folks that don't know, modern web apps typically spend a lot longer in Parsing & Compiling JS than you may think.

  • Yoav: This can particularly be an issue on mobile. Same files getting parsed all the time for users. Theoretically if we moved the parsing work to the server-side, we would have to worry about it less.
  • One angle to this problem is we all ship too much JavaScript. That's one perspective. We could also look at preprocessing.
  • We've been talking about this topic over the last few weeks a bit with V8. There were three main options proposed.
    1. Similar to what optimize-js does. Identify IIFEs and mark them as such so the browser and VMs heuristics will catch them and do a better job than today. optimize-js only tackles IIFE bu
@addyosmani
addyosmani / blinkon7.md
Last active Nov 14, 2017
blinkon7 - rough discussion topics
View blinkon7.md

Frameworks and tooling

ES2015 Modules.

How do you deploy them? What does this look like for Blink + Babel, frameworks? We've got nomodule coming. This looks like:

<script type="module" src="app.js"></script>
<script nomodule defer src="bundle.js"></script>
@addyosmani
addyosmani / flexbox-layout.css
Created Jan 29, 2017
Flexbox layout helper classes
View flexbox-layout.css
/*
Flexbox CSS helpers from the Polymer team. Extracted from https://github.com/PolymerElements/iron-flex-layout for use as just CSS.
Docs: https://elements.polymer-project.org/guides/flex-layout
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
View tti-rail.md

RAIL encouraged loading a site in under 1000ms on cable and (not well documented) between 3000ms and 5000ms on 3G. This loosely correlates to Google's research that 53% of mobile users will abandon a site if it doesn't load in 3s. So 5s is the headroom we give you for loading and becoming interactive so a user can realistically tap on a part of your user interface and have something useful happen. Loading is more nuanced than we as web developers once thought however.

It's is a pretty broad term and we don'the think it's enough for the page to "look" done. It should be engagable.

You can’t perform that action at this time.