zoukankan      html  css  js  c++  java
  • 万维网

    Client side performance

    Performance issues

    In the last years client side performance has become an issue. Many sites use Ajax and complex JavaScript for creating RIA applications resembling desktop apps. In many cases there are severe performance problems. 
    Browsers keep improving JavaScript's speed. Most of them use hotspot compilation for repeating code. Other optimizations are used, for instance Chrome's JavaScript engine uses hidden classes to decrease the penalty caused by JavaScript's dynamic qualities. 
    Other operations are also optimized and get faster each version. For example, Firefox speculative parser enables concurrent download of resources without interfering with the document processing. 

    Even with enhanced speed, performance is still an issue. Steve Souders, a "performance guru" from Google, checked and found out that in average, client side processing takes more time than the server side.

    Correct code makes good performance

    It is important to understand that the way we write our code has a dramatic influence on performance. 
    There are many resources for performance tips. Here are some good ones: 

    Performance tools

    There are some good tools for performance analysis and profiling. Unfortunately, they are currently specific to each browser. 
    There is a new Web Timing specification that is beginning to be implemented by Webkit and Firefox. This may allow for a unified performance tool for all browsers.


    Static analysis tool:

    • YSlow is a Firefox extension that checks the application and grades it according to its conformance with performance best practices. It does static analysis of the HTML code. The results are mostly applicable to all browsers, not just Firefox.
      Since it’s targeted towards Firefox, some fine grained performance problems in other browsers will be missed - for example Chrome and Safari react badly to inline style tags and perform style recalculation of the entire DOM tree, this is missed by YSlow.

    Run time profilers - these tools measure the browser's internal operations like resource loading, parsing, layout and painting:

      • For Chrome - Speed Tracer. A Chrome extension that gives performance information in a graphical way. It also gives you "hints" - marks the location of a potential problem and gives a clear textual explanation. 
        Very useful for finding performance bottlenecks. A great tool but only for Chrome (although the results will probably be relevant for other browsers).
      • For Safari and Chrome - Timeline tab. It is located in the developer tools that come with the browsers. It brings a subset of Speed Tracer data (both browsers are based on the same engine). The graphical view is less clear and it lacks Speed Tracer's performance hints. The developer tools include also a JavaScript profiler (CPU and heap). You can find a good quick start tutorial for developer tools here.
      • For Intenet Explorer - dynaTrace. An IE extension. It’s gives extensive profiling data. A nice feature - it can display the JavaScript code being executed, making it easy to pinpoint to the bottleneck code.
      • For Firefox - the well known Firebug extension. It contains only network information and JavaScript profiler - no internal browser operations data. Mozilla are going to add integrated developer tools support in their next Firefox release. Perhaps it will contain such data.
  • 相关阅读:
    艾伟:[WCF中的Binding模型]之六(完结篇):从绑定元素认识系统预定义绑定 狼人:
    艾伟:.NET框架4.0中都有些什么? 狼人:
    艾伟:WM有约(三):下一次是什么时候? 狼人:
    艾伟:为什么微软要推 ADO.NET Data Services Framework 狼人:
    艾伟:WM有约(二):配置信息 狼人:
    艾伟:F4何去何从 大视野观察Framework 4.0 狼人:
    艾伟:[WCF的Binding模型]之三:信道监听器(Channel Listener) 狼人:
    艾伟:.NET : 如何保护内存中的敏感数据? 狼人:
    艾伟:Silverlight 2.0 之旋转木马 狼人:
    艾伟:.NET和J2EE该相互学习什么 狼人:
  • 原文地址:https://www.cnblogs.com/SofuBlue/p/8029099.html
Copyright © 2011-2022 走看看