How to create high performance website
- Jun 24, 2021
- 1 min read
Updated: Jul 4, 2021
1. Reduce HTTP requests
HTTP request တိုင်းသည် page load time ကိုပျမ်းမျှ 200+ ms ထပ်တိုးစေပါသည်။ HTTP requests ကိုလျှော့ချရန်အတွက်ဆို script file တွေကို တတ်နိုင်သမျှ common file တစ်ခုတည်းဖြစ်အောင် ထားပါ။ CSS file တွေ ကိုလည်း common file တစ်ခုတည်းဖြစ်အောင်ထားပါ။
2. Minify resources
Small-sized files တွေက loading time ပိုမြန်တဲ့အတွက် ကိုယ့်ရဲ့ file မှာမလိုအပ်တဲ့ white space နဲ့ new line တွေကို ဖယ်ရှားပါ။ YUI Compressor သို့မဟုတ် UglifyJS ကဲ့သို့သောကိရိယာများကိုအသုံးပြုပြီးတော့လည်း resource ကို minify လုပ်လို့ရပါတယ်။
3. Compress components
text-based documents တွေနဲ့ resources တွေကို ချုံပြစ်ကလည်း server နဲ့ browser ကြား data transfer ချိန်ကို လျှော့ချပေးနိုင်ပါတယ်။ GZip compression ကတော့ data compress လုပ်ရာမှာ ယုံကြည်စိတ်ချရပြီး အသုံးများတဲ့ tool တစ်ခုဖြစ်ပါတယ်။
4. Use cookie-free domain
Browse တွေက request လုပ်သမျှ date တွေကို လိုအပ်သည်ဖြစ်စေ မလိုအပ်သည်ဖြစ်စေ data အကုန် cookie ကို ပို့ပေးပါတယ်။ styles, scripts, images နှင့် fonts ကဲ့သို့သော data တွေကိုပါ ပို့ပေးပါတယ်။
5. Style at the top and Script at the bottom
Style ကို <header> tag အတွင်း တွင်ထည့်ထားချင်းက site UI broken ဖြစ်တာကို ကာကွယ်ပေးပါတယ်။
Script elements တွေက HTML rendering ကို fully loaded မပြီးမချင်း block လုပ်ထားပါတယ်။ အဲ့အတွက်ကြောင့် script file တွေကို </body> tag တွင်ထားပေးပါ။
6. Do not scale images in HTML
အမှန်တစ်ကယ်လိုအပ်တဲ့ file size ထက် အဆမတန်ကြီးတဲ့ပုံကတွေကို upload တင်ပြီး အသုံးပြုခြင်းက bandwidth နဲ့ CPU ကို waste ဖြစ်စေရုံသာမက page load time ကို ပါ သိသိသာသာ တိုးစေပါတယ်။




Comments