设万维读者为首页 万维读者网 -- 全球华人的精神家园 广告服务 联系我们 关于万维
 
首  页 新  闻 视  频 博  客 论  坛 分类广告 购  物
搜索>> 发表日志 控制面板 个人相册 给我留言
帮助 退出
秋念11的博客  
好雨知时节,当春乃发生。 随风潜入夜,润物细无声。野径云俱黑,江船火独明。 晚看红湿处,花重锦官城。  
https://blog.creaders.net/u/5004/ > 复制 > 收藏本页
网络日志正文
22 Methods of Page Accelerate Technology 2015-03-24 13:26:35

Readers: web programmers, front-end developers.


An important issue currently for Web applications is page loading speed. If let people wait for a long time, they may feel uncomfortable and give up this site.


Page accelerate technology is to solve above issue and it is an important part of WPO (Web performance optimization) .


Generally, only the mobile devices have the issue because the desktop usually is very strong. However, most those methods may be used for desktop as well.


There are three related fields mobiles are obviously weak: CPU speed, network speed(or bandwidth), and memory. Memory limitation may cause problems when the page is using large amount of data, or large programs, or poor programming style, such as memory leaking. And as the results, that browser may collapse instead of slow down the page loading.


Really affecting the page loading speed are CPU, and network access. Particularly, the latter.


As a front-end or Web developer, we may reduce the burden on the network speed and CPU to improve page loading speed by below methods.


1)    Using external links for library, either CSS or JS since likely, they will be cached later instead of copying the contents directly inside the page(online).


2)    Using external links from CDN(Content Delivery Networks). It may help since they would be easily cached. Besides, the CDN site may be close to the users than your site.


3)    Merging as many files as possible to only one file for CSS and JS respectively. That can reduce HTTP calls.


4)    Uing minimum size files for CSS and JS, such as removing space and using ‘min’ file for JS.



5)    DNS translating IP address costs time so you may directly use the IP address for the links. Of course, you may still use the CDN display string for links displayed on the pages.


6)     HTTPS uses up a lot of resources so if possible, using HTTP, but implemening SSL for the important part, such as using HTTPS for AJAX.


7)    Using LocalStorage for bigger files and using cookies to store the names of files.


8)    Using front-end DB such as indexDB, and storing whole system/results on LocalStorage.


9)    Using catch for your HTML pages, in HTML5, it is straightforward and easily(.appcache). But also, you may need to set up/update expires in the header of the HTML pages.


10)  If possible, avoiding JS framework and library since they would not speed up the perfomance speed but cost source. Personally, I think jQuery is OK. However, for jQuery, you have to notice that a) not using selectors too broad, otherwise, too many tags would be used that would be costing. B) jQuery is automatic loops, so if not careful, the code would be wasting sources for too much loops.


11)  Using gzip to compress files for both text and binary.


12)  Avoiding using too many cookies which costs communication between client and server.


13)  For images, using JPG which is saving in size instead of other image formats.


14)  Using CSS3 sprites/translate tech --- using/downloading a big image and shift/viewport on a part on it according to requirement from program, instead of using multiple smaller images which needing multiple links.


15)  If possible, using HTML code and CSS code as much as possible, instead of using JavaScript. Forfunately, HTML5/CSS3 gives us more possibility for it. For example, for many light dynamic display, we may implement CSS class/psedoclasses. And in HTML5, there are many more powerful HTML tags, such as “range”,”date”,”progress”, which used to be made from JavaScript.

This, plus 14), meaning that for some simple animation we may not need JavaScript.


16)  JS script don’t need to work until the page loaded(display finished), so JS script/library should be placed after the HTML part is displayed. Dynamic CSS script has the similar issue but for static CSS part, it should be put inside header link or inline.


17)  Making pages as much static as possible. Doing as less back-end process as possible. For example, after login, the page would be the same to anyone. So the back-end code only needs to pick up information related to this particular user. And if the picking up would be time consuming(that is not good design already), you may load the page first and finally attached an external JS for the information of this guy. In short, any information pre-known before the next page calling, the server should prepare as much static as possible for pages. And of course, no redirection. This method may be the most important and need a bit high programming skills.


18)  Using cache in ajax.


19)  Using HTML web workers for multiple threats of JavaScript. The developer may need to carefully separate/distribute the JS code for it.


20)  For mobile, many pages in the beginning only display the top part and the user may scrolling down, so if need to speed up display, developer may design and load the the top part first.


21)  Changing AJAX to WbSocket which is a little faster. However, the change not only causes code changed in the front-end, but also you have to add a lot complex program on back-end.


22)  In JavaScript, doing smart programming, such as avoiding repeating some source costing call such “this” , so you can copy it to a variable like $this, smart strings concatenation, and some events such as resize, touchmove, one act may cause many events, so the code must smart enough to avoid all unnecessary event process. Besides, in binding event handler, don’t forget to unbind old one which may not cause bugs, but wasting sources. Finally, avoiding alert windows(and other pop HTML windows unless necessary), intead, using CSS windows, only cost less sources, but also, less annoying and easier to remove(after a while, or any touch event).

浏览(808) (0) 评论(0)
发表评论
我的名片
秋念11
注册日期: 2011-03-30
访问总量: 6,148,588 次
点击查看我的个人资料
Calendar
最新发布
· 中俄中东重挫/埃及破产/中西大交
· 中美俄三分天下
· 美国吃饱走人/核战一触即发/朝鲜
· 派谁去?
· 高歌猛进以色列,中国绥靖误大事
· 寇可往,我亦可往?
· 打台湾前必须准备好全面核大战
分类目录
【deleted】
【英文歌曲】
· 我和我的祖国
· love
· Amazed / Hold On
· angel of the morning / drive m
· 温哥华
· 儿歌:中国不投降
· 有个能人叫马云
· 一个温哥华朋友对郭文贵的政治解
· 利用唱歌反党,是一大发明
· 贝多芬音乐排名
【感想】
· 中俄中东重挫/埃及破产/中西大交
· 中美俄三分天下
· 美国吃饱走人/核战一触即发/朝鲜
· 派谁去?
· 高歌猛进以色列,中国绥靖误大事
· 寇可往,我亦可往?
· 打台湾前必须准备好全面核大战
· 叙利亚变天是伊斯兰原教旨复辟的
· 中俄重挫,普京欲哭无泪/连缅甸
· 埃尔多安再插普京一刀,翻身落马
存档目录
2024-12-01 - 2024-12-20
2024-11-01 - 2024-11-30
2024-10-01 - 2024-10-30
2024-09-04 - 2024-09-29
2024-08-02 - 2024-08-31
2024-07-03 - 2024-07-25
2024-06-01 - 2024-06-30
2024-05-03 - 2024-05-31
2024-04-05 - 2024-04-27
2024-03-01 - 2024-03-30
2024-02-01 - 2024-02-28
2024-01-03 - 2024-01-31
2023-12-01 - 2023-12-31
2023-11-01 - 2023-11-28
2023-10-01 - 2023-10-31
2023-09-06 - 2023-09-29
2023-08-03 - 2023-08-31
2023-07-01 - 2023-07-30
2023-06-07 - 2023-06-30
2023-05-02 - 2023-05-31
2023-04-02 - 2023-04-30
2023-03-02 - 2023-03-31
2023-02-01 - 2023-02-27
2023-01-04 - 2023-01-31
2022-12-03 - 2022-12-31
2022-11-06 - 2022-11-30
2022-10-01 - 2022-10-30
2022-09-02 - 2022-09-29
2022-08-01 - 2022-08-31
2022-07-02 - 2022-07-29
2022-06-02 - 2022-06-29
2022-05-01 - 2022-05-29
2022-04-01 - 2022-04-30
2022-03-01 - 2022-03-31
2022-02-03 - 2022-02-28
2022-01-01 - 2022-01-29
2021-12-01 - 2021-12-31
2021-11-04 - 2021-11-30
2021-10-02 - 2021-10-20
2021-09-02 - 2021-09-28
2021-08-01 - 2021-08-31
2021-07-01 - 2021-07-30
2021-06-01 - 2021-06-30
2021-05-01 - 2021-05-30
2021-04-03 - 2021-04-30
2021-03-02 - 2021-03-27
2021-02-01 - 2021-02-24
2021-01-01 - 2021-01-29
2020-12-03 - 2020-12-31
2020-11-02 - 2020-11-29
2020-10-03 - 2020-10-31
2020-09-01 - 2020-09-29
2020-08-01 - 2020-08-27
2020-07-01 - 2020-07-31
2020-06-01 - 2020-06-30
2020-05-01 - 2020-05-31
2020-04-01 - 2020-04-30
2020-03-03 - 2020-03-31
2020-02-01 - 2020-02-29
2020-01-01 - 2020-01-29
2019-12-01 - 2019-12-31
2019-11-01 - 2019-11-28
2019-10-01 - 2019-10-31
2019-09-01 - 2019-09-30
2019-08-04 - 2019-08-31
2019-07-07 - 2019-07-31
2019-06-01 - 2019-06-29
2019-05-01 - 2019-05-30
2019-04-01 - 2019-04-29
2019-03-01 - 2019-03-30
2019-02-01 - 2019-02-25
2019-01-03 - 2019-01-31
2018-12-01 - 2018-12-30
2018-11-02 - 2018-11-30
2018-10-01 - 2018-10-31
2018-09-01 - 2018-09-30
2018-08-01 - 2018-08-31
2018-07-01 - 2018-07-31
2018-06-01 - 2018-06-30
2018-05-01 - 2018-05-31
2018-04-02 - 2018-04-30
2018-03-01 - 2018-03-30
2018-02-01 - 2018-02-28
2018-01-02 - 2018-01-29
2017-12-01 - 2017-12-30
2017-11-02 - 2017-11-29
2017-10-02 - 2017-10-29
2017-09-01 - 2017-09-30
2017-08-03 - 2017-08-26
2017-07-03 - 2017-07-31
2017-06-01 - 2017-06-29
2017-05-01 - 2017-05-31
2017-04-01 - 2017-04-30
2017-03-01 - 2017-03-28
2017-02-02 - 2017-02-28
2017-01-03 - 2017-01-31
2016-12-31 - 2016-12-31
2016-11-01 - 2016-11-28
2016-10-09 - 2016-10-29
2016-09-01 - 2016-09-18
2016-08-01 - 2016-08-31
2016-07-01 - 2016-07-31
2016-06-01 - 2016-06-29
2016-05-01 - 2016-05-31
2016-04-01 - 2016-04-30
2016-03-01 - 2016-03-31
2016-02-03 - 2016-02-28
2016-01-02 - 2016-01-31
2015-12-01 - 2015-12-30
2015-11-01 - 2015-11-28
2015-10-01 - 2015-10-30
2015-09-01 - 2015-09-29
2015-08-05 - 2015-08-31
2015-07-01 - 2015-07-30
2015-06-03 - 2015-06-30
2015-05-03 - 2015-05-31
2015-04-04 - 2015-04-21
2015-03-05 - 2015-03-30
2015-02-07 - 2015-02-26
2015-01-01 - 2015-01-17
2014-12-07 - 2014-12-27
2014-10-03 - 2014-10-18
2014-09-01 - 2014-09-25
2014-08-12 - 2014-08-27
2014-07-05 - 2014-07-20
2014-06-01 - 2014-06-06
2014-05-19 - 2014-05-19
2014-04-19 - 2014-04-27
2014-03-27 - 2014-03-27
2014-01-04 - 2014-01-04
2013-12-01 - 2013-12-28
2013-11-10 - 2013-11-23
2013-10-14 - 2013-10-29
2013-09-21 - 2013-09-21
2013-08-16 - 2013-08-27
2013-07-04 - 2013-07-27
2013-06-23 - 2013-06-23
2013-05-02 - 2013-05-24
2013-04-04 - 2013-04-29
2013-03-02 - 2013-03-29
2013-02-25 - 2013-02-28
2013-01-07 - 2013-01-28
2012-12-02 - 2012-12-31
2012-11-07 - 2012-11-15
2012-10-01 - 2012-10-29
2012-09-15 - 2012-09-15
2012-08-02 - 2012-08-27
2012-07-16 - 2012-07-29
2012-06-20 - 2012-06-20
2012-05-01 - 2012-05-12
2012-04-06 - 2012-04-16
2012-03-05 - 2012-03-25
2012-02-09 - 2012-02-25
2012-01-14 - 2012-01-24
2011-12-14 - 2011-12-28
2011-11-11 - 2011-11-26
2011-10-15 - 2011-10-29
2011-09-02 - 2011-09-12
2011-08-02 - 2011-08-25
2011-07-01 - 2011-07-23
2011-06-19 - 2011-06-26
2011-05-23 - 2011-05-23
 
关于本站 | 广告服务 | 联系我们 | 招聘信息 | 网站导航 | 隐私保护
Copyright (C) 1998-2024. Creaders.NET. All Rights Reserved.