Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Performance Optimizing Tips
Search
Oanh Nguyen
November 11, 2015
Programming
0
17
Performance Optimizing Tips
Some performance optimizing tips
Oanh Nguyen
November 11, 2015
Tweet
Share
More Decks by Oanh Nguyen
See All by Oanh Nguyen
Tư duy caching trong lập trình Web
oanhnn
0
350
Other Decks in Programming
See All in Programming
品質ワークショップをやってみた
nealle
0
620
ALL CODE BASE ARE BELONG TO STUDY
uzulla
27
6.7k
alien-signals と自作 OSS で実現する フレームワーク非依存な ロジック共通化の探求 / Exploring Framework-Agnostic Logic Sharing with alien-signals and Custom OSS
aoseyuu
2
520
20251016_Rails News ~Rails 8.1の足音を聴く~
morimorihoge
3
710
CSC509 Lecture 06
javiergs
PRO
0
270
Google Opalで使える37のライブラリ
mickey_kubo
3
140
One Enishi After Another
snoozer05
PRO
0
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
450
技術的負債の正体を知って向き合う
irof
0
240
Six and a half ridiculous things to do with Quarkus
hollycummins
0
210
Leading Effective Engineering Teams in the AI Era
addyosmani
7
600
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
130
Featured
See All Featured
Statistics for Hackers
jakevdp
799
220k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
Product Roadmaps are Hard
iamctodd
PRO
55
11k
Fireside Chat
paigeccino
41
3.7k
Rails Girls Zürich Keynote
gr2m
95
14k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
A better future with KSS
kneath
239
18k
Automating Front-end Workflow
addyosmani
1371
200k
Reflections from 52 weeks, 52 projects
jeffersonlam
353
21k
It's Worth the Effort
3n
187
28k
Transcript
PERFORMANCE OPTIMIZING TIPS FOR PHP WEBSITE OanhNN & QuangNV
Content: • Web system • Web resources • How gzip
compression works • HTTP Caching • PHP performance tips • Others
Web system Database Cache DB (memcached, apc, …) Web App
(PHP, ASP, JSP, …) Web resources (css, js, img, …) Web server + HTTP Cache Web browser, App client
Web resources: • HTML (static page) • CSS • Javascript
• Images • ….
HTML • Use HTML 5: new, lightweight, … • According
to the HTML 4 DTD, you can omit the following tags. • Combine external JavaScript files • Include external CSS files before external JavaScript files
CSS • Remove unused CSS. • Using every declaration just
once means making strict use of selector grouping. • Minify CSS files.
Javascript (js) • Optimizing JavaScript code • Speeding up JavaScript:
Working with the DOM • Minify JavaScript • Compressing your JavaScript with Closure Compiler • Use Asynchronous load
Images & Web graphics • Compress images (TinyPNG) • Use
a lot of small images on big images • Use lazy load • Optimizing canvas draw
Gzip
Gzip • Browser: • Connects to server. • Notifies server
that browser supports gzip "Accept-Encoding: gzip". • Server: • Acknowledges gzip support. • Sends gzip encoded page with header "Content-Encoding: gzip". • Browser: • Receive page. • Decode gzip encoded page based on header "Content-Encoding: gzip". • Display page.
HTTP Caching
PHP performance tips • Upgrade your version of PHP •
Use caching • Use output buffering • Avoid writing naive setters and getters • Don't copy variables for no reason • Avoid doing SQL queries within a loop • Sometimes, performance of native PHP function is not best
native function vs. defined function
native function vs. defined function
Others • Using HTML 5 for performance improvements • Store
web resources on diff • Reduce the number of requests and the amount of data transferred
References • https://developers.google.com/speed/articles • https://developers.google.com/speed/articles/optimizing-i mages • http://phpmaster.com/
Q&A