SlideShare une entreprise Scribd logo
1  sur  43
Télécharger pour lire hors ligne
JS in Rural Communities

Matthew
Keas
@matthiasak

http://mkeas.org

http://parivedasolutions.com
!e
Ky
Rr e
Ayou
He
he

r

n
po
u
en gons
p

a
p
ha of dr
y
ma o r y
t
as
"one of the senior engineers began a rant about the
page weight of the video watch page being far too
large"
"1.2MB and dozens of requests"
"if they can write an entire Quake clone in under
100KB, we have no excuse for this!"
"After  three  painstaking  days,  I  had  arrived  at  a  much  leaner
solution.  It  still  was  not  under  100KB  though.  Having  just
finished  writing  the  HTML5  video  player,  I  decided  to  plug  it
in  instead  of  the  far  heavier  Flash  player.  Bam!  98KB  and
only  14  requests."

tiny

HTML
"I decided to limit the functionality"
masthead
video player
five related videos
sharing button
flagging tool
ten comments loaded in via AJAX

remedy?
"After  a  week  of  data  collection,  the  numbers  came  back…
and  they  were  baffling.  The  average  aggregate  page  latency
under  Feather  had  actually  INCREASED"

HALLOWEEN

Party
"We  plotted  the  data  geographically  and  compared  it  to  our  total
numbers  broken  out  by  region"

hello!
howdy!

YOUTUBE
.  YES!!
Southeast Asia

A m e ri c a
South

OPEN
Come in,

Re
m

ot
e

Si
be

ri a

WE’RE

A

ca
ri
f
Average page load time under Feather was over TWO
MINUTES!

50
POSTAGE
STAMP

Normal page would take over 20 minutes.
"By keeping your client side code small and
lightweight, you can literally open your product up
to new markets."

ADDING

MATT'ISM

Improve you experience and broaden your reach
with:
• Fewer requests per page load
• Smaller requests per page load
• Less frequent requests per page load
ADDING

MATT'ISM

Improve you experience and broaden your reach
with:
• Fewer requests per page load (inlining, base64
encoding)
• Smaller requests per page load (concatenation,
compression, minification)
• Less frequent requests per page load (caching)
IF YOU CARE
CACHE
OR BEWARE
Methods of Caching?
Implied persistence
HTML <meta> tags
(http://www.mnot.net/cache_docs/)
HTTP Headers
(http://www.mobify.com/blog/beginners-guideto-http-cache-headers/)
Persist data via cookies...
Appcache
JavaScript?
23

ADMIT
NONE

17
HTML <meta> tags
Meta tags are easy to use, but aren’t very effective.
That’s because they’re only honored by a few
browser caches, not proxy caches (which almost
never read the HTML in the document).
HTTP Headers
Example Caching headers for dynamic content (Wordpress blog):

HTTP/1.1 200 OK
Cache-Control: no-transform,public,max-age=300,s-maxage=900
Content-Type: text/html; charset=UTF-8
Date: Mon, 29 Apr 2013 16:38:15 GMT
ETag: "bbea5db7e1785119a7f94fdd504c546e"
Last-Modified: Sat, 27 Apr 2013 00:44:54 GMT
Server: AmazonS3
Vary: Accept-Encoding
X-Cache: HIT
HTML5 Appcache
(http://caniuse.com/#search=appcache
)
No support IE9- (trolololollllll)
Offline browsing - users can navigate your full site
when they're offline. (good)
Speed - cached resources are local, and therefore
load faster. (good)
Reduced server load (good)

Pretty Sexy
HTML Appcache
Más Problemas
http://appcachefacts.info
/

One failed file in CACHE section => entire cache
disregarded.
Regardless of whether you include the address
of the current page in the manifest, it will be
cached.
In Firefox, any resources served with Cachecontrol: no-store will not be cached, even if
they're explicitly included in the manifest.
No granular dynamic control from JS.

:–(
Is using JS to manage your cache
reasonable?
Yes. (http://caniuse.com/#feat=namevalue-storage)
If you need to support IE7 or Opera Mobile, then
employ HTTP Headers and/or just load resources
lazily.
Also, polyfills.
IE8 implemented this?
Wow.
Is this an original idea?
Sort of.

Anal
y

tics
Many Script Loaders Employed
Today
We truly are spoiled with such an
awesome community
We started POC'ing Local
Storage as a cache

Local
St

orage

KIC
KS
GRA
SS
SINC
E IE8
Local Storage
Like  cookies
Persistent
At least 5MB
Never attached blindly to requests
Event model to keep other tabs and windows
synchronized
Polyfills
Broke-al Storage
String values only — serialization may be
necessary (awkward)
Unstructured data with no transactions, indexing
or searching facilities (awkward)
May exhibit poor performance on large datasets
(bad)
Loader
https://github.com/matthiasak/Loader

ary year
nor he
ho t

of
me
na

oa
L

r
e
d
Loading Browser Assets
CORS compatible or Same Origin? AJAX in
parallel, cache, and execute/embed sequentially.
Not Same Origin? Add Script/Link and set the
src/href.
Loading Browser Assets
Promises to control flow of async downloads and
"readystates".
Small abstraction for making a GET
Small functions to write tags to the <HEAD>
Tiny abstraction for Local Storage and error
handling
Automatically look for files to load (in similar
fashion to Require.js)
Begin by Loading Loader
Load Only What Is Needed
1

2

3
Performance, Pro-formance
http://www.stevesouders.com/blog/2011/03/28/storager-case-study-binggoogle/

"Bing and Google Search make extensive use of
localStorage for stashing SCRIPT and STYLE blocks
that are used on subsequent page views. None of
the other top sites from my previous post use
localStorage in this way. Are Bing and Google
Search onto something?
Yes, definitely."
Real-World Testing?
http://jsperf.com/localstorage-versus-browsercache/6
"Cutting the mustard"
http://responsivenews.co.uk/post/18948466399/cutting-themustard
Where I Put My Experiments Before
They Are Ready For Primetime
FIRS
T
VISIT
FIRST
VISIT
SPEED
DEMON?
SECOND VISIT

!
SECOND
VISIT
THANK
YOU
@matthiasak

Contenu connexe

Tendances

ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007
Barry Abrahamson
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
Barry Abrahamson
 

Tendances (20)

PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark Tomlinson
 
State of the Web
State of the WebState of the Web
State of the Web
 
ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007
 
Speed kills
Speed killsSpeed kills
Speed kills
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
 
High Performance WordPress II
High Performance WordPress IIHigh Performance WordPress II
High Performance WordPress II
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
 
Website Backup
Website Backup Website Backup
Website Backup
 
Cache is keeping you from reaching the full potential as a developer (word ca...
Cache is keeping you from reaching the full potential as a developer (word ca...Cache is keeping you from reaching the full potential as a developer (word ca...
Cache is keeping you from reaching the full potential as a developer (word ca...
 
Use Xdebug to profile PHP
Use Xdebug to profile PHPUse Xdebug to profile PHP
Use Xdebug to profile PHP
 
Ui perf
Ui perfUi perf
Ui perf
 
How to make your site 5 times faster in 10 minutes
How to make your site 5 times faster in 10 minutesHow to make your site 5 times faster in 10 minutes
How to make your site 5 times faster in 10 minutes
 
21 Ways to Make WordPress Fast
21 Ways to Make WordPress Fast21 Ways to Make WordPress Fast
21 Ways to Make WordPress Fast
 
Cache Rules Everything Around Me
Cache Rules Everything Around MeCache Rules Everything Around Me
Cache Rules Everything Around Me
 
Wordpress horsepower
Wordpress horsepowerWordpress horsepower
Wordpress horsepower
 
Front-End Web Performance Optimization by BucketSoft
Front-End Web Performance Optimization by BucketSoftFront-End Web Performance Optimization by BucketSoft
Front-End Web Performance Optimization by BucketSoft
 
Measuring Web Performance
Measuring Web Performance Measuring Web Performance
Measuring Web Performance
 
Metarefresh
MetarefreshMetarefresh
Metarefresh
 
Building Faster Websites
Building Faster WebsitesBuilding Faster Websites
Building Faster Websites
 

Similaire à JS in Rural Communities

Tuning Your SharePoint Environment
Tuning Your SharePoint EnvironmentTuning Your SharePoint Environment
Tuning Your SharePoint Environment
vmaximiuk
 
Web Client Performance
Web Client PerformanceWeb Client Performance
Web Client Performance
Herea Adrian
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
drupalcampest
 

Similaire à JS in Rural Communities (20)

JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017
 
Advanced Drupal 8 Caching
Advanced Drupal 8 CachingAdvanced Drupal 8 Caching
Advanced Drupal 8 Caching
 
Oracle UCM: Web Site Performance Tuning
Oracle UCM: Web Site Performance TuningOracle UCM: Web Site Performance Tuning
Oracle UCM: Web Site Performance Tuning
 
Local Storage for Web Applications
Local Storage for Web ApplicationsLocal Storage for Web Applications
Local Storage for Web Applications
 
Scaling 101 test
Scaling 101 testScaling 101 test
Scaling 101 test
 
Scaling 101
Scaling 101Scaling 101
Scaling 101
 
Caching and Its Main Types
Caching and Its Main TypesCaching and Its Main Types
Caching and Its Main Types
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 
Tuning Your SharePoint Environment
Tuning Your SharePoint EnvironmentTuning Your SharePoint Environment
Tuning Your SharePoint Environment
 
Web Client Performance
Web Client PerformanceWeb Client Performance
Web Client Performance
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
Amazon silk browser
Amazon silk browserAmazon silk browser
Amazon silk browser
 
Speed!
Speed!Speed!
Speed!
 
The Server Side of Responsive Web Design
The Server Side of Responsive Web DesignThe Server Side of Responsive Web Design
The Server Side of Responsive Web Design
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
A Day Building Fast, Responsive, Extensible Single Page Applications
A Day Building Fast, Responsive, Extensible Single Page ApplicationsA Day Building Fast, Responsive, Extensible Single Page Applications
A Day Building Fast, Responsive, Extensible Single Page Applications
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
 
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 201210 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 

Dernier

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

JS in Rural Communities