SlideShare a Scribd company logo
from 2010 to now...
Client Side
Rendering is
Not So Easy
Nuria Ruiz
@pantojacoder
What is client side
rendering?
Client Side rendering Not so Easy
To move
rendering to the
client you
need two things.
A Template Engine
Templates
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{{value}}}
</div>
</div>
{
title : "Pretty Thing",
value : "33"
}
Loads of
Javascript in
the client.
WARNING !!!!
About 1 billion page
requests every day.
10% on IE7
0.5% on IE6
Data from 2011
We had a loading bar.
We have a thick
Javascript client.
We offer several languages:
Spanish, English, Catalan...
Back to loads of Javascript in the
client...
Remember
that loading
bar?
500 K compressed,
23 requests ~
3300 K of
Javascript !!!!
Performance Problem #1
Eager loading
of Javascript.
Async !=Lazy
Templates were
plain HTML
documents.
Performance Problems #2
and #3
<div class="footer">
<div>
<a class="hide" href="%sectionLink%">
<fw:translate id="Video.video_view_more">
%(video_view_more_link)View more...
</fw:translate>
</a>
</div>
</div>
We needed to do ajax to
retrieve templates, which
were HTML docs (cannot use
<script>).
and
Loads of walking the DOM to
insert data.
Client Side rendering Not so Easy
Step
BACK
With as much Javascript we
had in the client nothing is
going to go fast.
Fact #1
We need to load Javascript
lazily.
Client Side rendering Not so Easy
How does the YUI
lazy loading work?
Client Side rendering Not so Easy
<a href="#m=Albums&amp;func=index" onclick=​"
Bootloader('t-albums','Request('?
m=Albums&func=index'))​;​return false;​" title=​"My
photo albums">​…​</a>​
Each link does an HTTP request to
retrieve the Javascript needed.
YUI().use('t-albums')
Client Side rendering Not so Easy
We can
remove the
loading bar.
Fact #2
We need to start
from scratch on
the template
engine.
Client Side rendering Not so Easy
Works using a
Lexical Parser.
Based on Jison, a Javascript
parser generator.
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{{body}}}
</div>
</div>
Template:
$ npm install handlebars
$ /usr/bin/handlebars sample_template.js
Builds a grammar based on HTML
that compiles to Javascript.
Compilation:
(function() {
var template = Handlebars.template; templates
['sample_template.js'] = template(
function (Handlebars,depth0,helpers,partials,data) {
helpers = helpers || Handlebars.helpers;
var self = this;
buffer += "<div class="entry">n <h1>";
stack1 = helpers.title || depth0.title;
.....
}
buffer += escapeExpression(stack1) + "</h1>n <div
class="body">n ";
....
buffer += escapeExpression(stack1) + "n </div>n
</div>n";
return buffer;
});
})()
No More
DOM manipulation
Why Handlebars?
If-Else constructors
Precompilation
Actively Worked on.
How do we download templates?
With YUI, just like anything else,
templates now are Javascript.
<a href="#m=Photo&amp;func=index" onclick=​"Bootloader
('t-photo','Request('?m=Photo&func=index'))​;​return false;​"
title=​"My photos">​…​</a>​
YUI walks the
dependency tree.
Client Side rendering Not so Easy
Translations client-side
{{{translate "Photos" "%
(photo_save_title)Save"}}}
Do we use Client
Side Rendering
for everything?
No
Features that exist ONLY
client side, like
overlays, autocomplete,
spinners, chat UI.
Features for which there are
significant CPU savings to be
done, e.g. high traffic pages
like photos.
Last
Thoughts.
Do not think
about
problems
in isolation.
Use the right
tool for the
job.
Measure
Everything.
5 times faster
Questions?

More Related Content

What's hot (20)

PPTX
Polymer and web component
Imam Raza
 
PDF
Web Components
Nikolaus Graf
 
PDF
Data presentation with dust js technologies backing linkedin
Ruhaim Izmeth
 
PDF
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
PPTX
Building single page applications
SC5.io
 
PDF
Introduction to Web Components
Fu Cheng
 
PDF
Polymer, A Web Component Polyfill Library
naohito maeda
 
PDF
The Complementarity of React and Web Components
Andrew Rota
 
PDF
Build Reusable Web Components using HTML5 Web cComponents
Gil Fink
 
PDF
Kickstarting Node.js Projects with Yeoman
Patrick Buergin
 
PDF
Node.js Crash Course (Jump Start)
Haim Michael
 
PPTX
Vue presentation
Norbert Nader
 
PPTX
Workshop Intro: FrontEnd General Overview
Visual Engineering
 
PPTX
Web Components
FITC
 
PPTX
Single Page WebApp Architecture
Morgan Cheng
 
PDF
Chrome enchanted 2015
Chang W. Doh
 
PDF
Polymer
jskvara
 
PDF
Solution to capture webpage screenshot with html2 canvas.js for backend devel...
eLuminous Technologies Pvt. Ltd.
 
PPTX
Vue js for beginner
Chandrasekar G
 
PDF
Levent-Gurses' Introduction to Web Components & Polymer
Erik Isaksen
 
Polymer and web component
Imam Raza
 
Web Components
Nikolaus Graf
 
Data presentation with dust js technologies backing linkedin
Ruhaim Izmeth
 
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
Building single page applications
SC5.io
 
Introduction to Web Components
Fu Cheng
 
Polymer, A Web Component Polyfill Library
naohito maeda
 
The Complementarity of React and Web Components
Andrew Rota
 
Build Reusable Web Components using HTML5 Web cComponents
Gil Fink
 
Kickstarting Node.js Projects with Yeoman
Patrick Buergin
 
Node.js Crash Course (Jump Start)
Haim Michael
 
Vue presentation
Norbert Nader
 
Workshop Intro: FrontEnd General Overview
Visual Engineering
 
Web Components
FITC
 
Single Page WebApp Architecture
Morgan Cheng
 
Chrome enchanted 2015
Chang W. Doh
 
Polymer
jskvara
 
Solution to capture webpage screenshot with html2 canvas.js for backend devel...
eLuminous Technologies Pvt. Ltd.
 
Vue js for beginner
Chandrasekar G
 
Levent-Gurses' Introduction to Web Components & Polymer
Erik Isaksen
 

Similar to Client Side rendering Not so Easy (20)

PDF
YUI - HackU 2010 IIT Mumbai
knutties
 
KEY
Running YUI 3 on Node.js - JSConf 2010
Adam Moore
 
KEY
Running YUI 3 on Node.js - BayJax
Adam Moore
 
PDF
Hack U - YUI - 2012 IIT Kharagpur
Sumana Hariharan
 
KEY
Let's run JavaScript Everywhere
Tom Croucher
 
PPT
YUI3 - IIT Madras HackU
Jayasurian Makkoth
 
PPT
Yuihacku iitd-sumana
Sumana Hariharan
 
PDF
JavaScript Everywhere! Creating a 100% JavaScript web stack
Tom Croucher
 
PDF
Introduction to YUI
Christian Heilmann
 
PDF
Neoito — How modern browsers work
Neoito
 
PPT
YUI open for all !
Subramanyan Murali
 
PDF
Server Side JavaScript - You ain't seen nothing yet
Tom Croucher
 
PPTX
Hack with YUI
Luke Smith
 
PDF
Yui intro
Aditya Gaur
 
PDF
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
Joseph Chiang
 
PPT
Web browser
Abhijeet Shah
 
PPTX
YUI for your Hacks
Subramanyan Murali
 
PDF
Purple Hack Fodder - my presentation at mashed08
Christian Heilmann
 
PPT
Hacking with YUI 3 - Open Hack Day 2011
knutties
 
PPTX
YUI (Advanced)
Jai Santhosh
 
YUI - HackU 2010 IIT Mumbai
knutties
 
Running YUI 3 on Node.js - JSConf 2010
Adam Moore
 
Running YUI 3 on Node.js - BayJax
Adam Moore
 
Hack U - YUI - 2012 IIT Kharagpur
Sumana Hariharan
 
Let's run JavaScript Everywhere
Tom Croucher
 
YUI3 - IIT Madras HackU
Jayasurian Makkoth
 
Yuihacku iitd-sumana
Sumana Hariharan
 
JavaScript Everywhere! Creating a 100% JavaScript web stack
Tom Croucher
 
Introduction to YUI
Christian Heilmann
 
Neoito — How modern browsers work
Neoito
 
YUI open for all !
Subramanyan Murali
 
Server Side JavaScript - You ain't seen nothing yet
Tom Croucher
 
Hack with YUI
Luke Smith
 
Yui intro
Aditya Gaur
 
yui3 is Sexy - 使用 YUI 3 的 Sexy Part !
Joseph Chiang
 
Web browser
Abhijeet Shah
 
YUI for your Hacks
Subramanyan Murali
 
Purple Hack Fodder - my presentation at mashed08
Christian Heilmann
 
Hacking with YUI 3 - Open Hack Day 2011
knutties
 
YUI (Advanced)
Jai Santhosh
 
Ad

More from nuria_ruiz (6)

PDF
Wikipedia 101 governance and tech stack
nuria_ruiz
 
PDF
Data and privacy at scale at wikipedia strata
nuria_ruiz
 
PDF
(Some of) Wikipedia's Open Data
nuria_ruiz
 
PDF
The most popular browser
nuria_ruiz
 
PDF
The dashboarding problem
nuria_ruiz
 
PDF
Performace optimizations and frontend happiness
nuria_ruiz
 
Wikipedia 101 governance and tech stack
nuria_ruiz
 
Data and privacy at scale at wikipedia strata
nuria_ruiz
 
(Some of) Wikipedia's Open Data
nuria_ruiz
 
The most popular browser
nuria_ruiz
 
The dashboarding problem
nuria_ruiz
 
Performace optimizations and frontend happiness
nuria_ruiz
 
Ad

Recently uploaded (20)

PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Complete Network Protection with Real-Time Security
L4RGINDIA
 
PDF
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
July Patch Tuesday
Ivanti
 
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Complete Network Protection with Real-Time Security
L4RGINDIA
 
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 

Client Side rendering Not so Easy