高性能JavaScript - 【美】Nicholas C. Zakas(尼古拉斯.泽卡斯)

高性能JavaScript

【美】Nicholas C. Zakas(尼古拉斯.泽卡斯)

出版时间

2015-07-31

ISBN

9787121266775

评分

★★★★★

标签

web编程

AI导读
核心看点
  • 系统解析脚本加载、数据访问及DOM操作的性能优化策略
  • 深入剖析作用域链、原型链等底层机制对执行效率的影响
  • 提供构建部署最佳实践及线上问题定位工具的使用指南
适合谁读
  • 希望提升Web应用响应速度、消除性能瓶颈的前端开发者
  • 具备一定JS基础,寻求进阶并优化代码质量的工程师
  • 关注浏览器渲染原理及底层运行机制的技术爱好者
读前提醒
  • 书中部分构建工具及部署技术已显陈旧,建议批判性阅读
  • 重点学习前八章的核心思想与编码习惯,后两章可略读
  • 结合现代前端工程化实践,灵活借鉴书中的优化理念
读者共识
  • 被誉为JS性能优化领域的经典神书,字字珠玑,含金量高
  • 虽出版较早部分技术过时,但底层原理与思想依然极具价值
  • 内容精炼实用,有助于巩固JS基础并培养良好的编码习惯

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "• Literal values and local variables can be accessed very quickly, whereas array items and object members take longer. • Local variables are faster to access than out-of-scope variables because they exist in the first variable object of the scope chain. The further into the scope chain a variable is"
  • "• Minimize DOM access, and try to work as much as possible in JavaScript. • Use local variables to store DOM references you’ll access repeatedly. • Be careful when dealing with HTML collections because they represent the live, underlying document. Cache the collection length into a variable and use "
  • "1. 使元素脱离文档流 2. 对其应用多重改变 3. 把元素带回文档中 有三种基本方法可以使 DOM 脱离文档: - 隐藏元素,应用修改,重新显示 - 使用文档片段(document fragment)在当前 DOM 之外构建一个子树,再把它拷贝回文档 - 将原始元素拷贝到一个脱离文档的节点中,修改副本,完成后再替换原始元素"
  • "一个长度为 n 的数组最终会调用 mergeSort() 2*n-1 次,这意味着一个长度超过 1500 的数组会在 Firefox 上发生栈溢出错误。"
  • "One word of caution: it is not recommended to use this technique for object methods. Many object methods use this to determine the context in which they are being called, and storing a method in a local variable causes this to be bound to window. Changing the value of this leads to programmatic erro"
  • "Firefox, Opera, Chrome, and Safari 3+ all fire a load event when the src of a <script> element has been retrieved. You can therefore be notified when the script is ready by listening for this event:"
  • "If you only care about sending data to the server (with possibly a very simple response), use image beacons. Beacons are the fastest and most efficient way to send data back to the server. The server doesn’t have to send back any response body at all, so you don’t have to worry about downloading dat"
  • "These two functions implement a lazy-loading pattern. The first time either method is called, a check is made to determine the appropriate way to attach or detach the event handler. Then, the original function is overwritten with a new function that contains just the appropriate course of action. Th"
目录
前言 I
第1章:加载和执行 1
1.1 脚本位置 2
1.2 组织脚本 4
1.3 无阻塞的脚本 5

显示全部
用户评论
成书很早,所以有些语法啥的过时了,不过里面介绍的优化思想没有过时。对养成良好的代码习惯帮助很大。
JSer 必看
发现自己很喜欢研究性能... 精益求精,了解一点数据结构相关再回过头来看看这本书,收获更大。不过毕竟第一版出来到现在七年多了,有些内容确实老了,只能学习思想。
从性能优化的角度,重新看一些问题。一些小技巧很实用。
少量内容虽然有些过时,但是还是值得一读的。
非常不错的书,虽然已经经过了7年,不过里面70%的内容都不过时,非常值得一读。
神了
下载
收藏