`
lucene3211
  • 浏览: 113739 次
  • 性别: Icon_minigender_2
  • 来自: 广州
社区版块
存档分类
最新评论

Speed up your JavaScrip 3[]

    博客分类:
  • java
阅读更多
    <div class="blog_content">影响javascript性能的另外一个杀手就是递归,在上一节中提到采用memoization技术可以优化计算数值的递归函数,但 memoization不是万能的,不是所有的递归函数都可以用memoization技术优化,本文介绍了这些情况,并介绍了解决办法,就是将递归转换为迭代,同时需要注意,本文末尾介绍的方案不是最终的方案,还需要和上一节优化循环的方案综合起来才能达到最佳效果。
【原文】<span style="color: #108ac6;">speed up your javascript, part 3</span><br>【作者】nicholas c. zakas<br>【译文】<span style="color: #108ac6;">http://cuimingda.com/2009/02/speed-up-your-javascript-part-3.html</span><br>【译者】<span style="color: #108ac6;">明达</span>
以下是对原文的翻译
递归是拖慢脚本运行速度的大敌之一。太多的递归会让浏览器变得越来越慢直到死掉或者莫名其妙的突然自动退出,所以我们一定要解决在 javascript中出现的这一系列性能问题。在这个系列文章的第二篇中,我曾经简短的介绍了如何通过memoization技术来替代函数中太多的递归调用。memoization是一种可以缓存之前运算结果的技术,这样我们就不需要重新计算那些已经计算过的结果。对于通过递归来进行计算的函数,memoization简直是太有用了。我现在使用的memoizer是由 crockford写的,主要应用在那些返回整数的递归运算中。当然并不是所有的递归函数都返回整数,所以我们需要一个更加通用的memoizer()函数来处理更多类型的递归函数。
 
<div class="dp-highlighter"><div class="bar"><div class="tools">java代码
0
0
分享到:
评论

相关推荐

    Enhancing Adobe Acrobat DC Forms with JavaScript

    You’ll also discover how a few lines of code can speed up your workflow when working with multiple PDFs in Action Wizard. Enhancing Adobe Acrobat DC Forms with JavaScript covers up-to-date, real ...

    Beginning JavaScript, 4th Edition

    to-date JavaScript programming techniquesContinuing in the superlative tradition of the first three editions, Beginning JavaScript, Fourth Edition, gets you up to speed on all the new advances in ...

    [JavaScript] JavaScript 从入门到精通 (英文版)

    Speed up and simplify app development with jQuery Quickly retrieve data from a server using AJAX requests Adapt your app for mobile devices with jQuery Mobile Build Windows 8 apps using HTML, CSS, and...

    Beginning JavaScript with DOM Scripting and Ajax: Second Editon

    This completely updated second edition covers everything you need to know to get up-to-speed with JavaScript development and add dynamic enhancements to web pages, right from the basics. As well as ...

    Mastering.JavaScript.High.Performance.1784397296

    Next, you will move on to learn about DOM optimization, JavaScript promises, and web workers to better break up your large codebase. You will also learn about JavaScript performance on mobile ...

    Beginning JavaScript with DOM Scripting and Ajax (pdf + ePub)

    This completely updated second edition covers everything you need to know to get up-to-speed with JavaScript development and add dynamic enhancements to web pages, right from the basics. As well as ...

    Jasmine.JavaScript.Testing.2nd.Edition.1785282042

    You will also take a look at integrated testing with React.js and Karma, and how you can speed this process up by faking AJAX requests. As you progress through the book, you will learn about the ...

    Coding with JavaScript For Dummies

    you, this book will quickly and easily bring you up to speed. Whether you know a little JavaScript or you’ve never seen it, this book shows you how to write JavaScript the right way. Topics covered ...

    Jasmine JavaScript Testing(PACKT,2ed,2015)

    You will also take a look at integrated testing with React.js and Karma, and how you can speed this process up by faking AJAX requests. As you progress through the book, you will learn about the ...

    Web性能优化系列 10个提升JavaScript性能的技巧

    当谈到 JS 性能的时候,Zakas差不多就是你要找的,2010年六月他在Google Tech Talk发表了名为《Speed Up Your Javascript》的演讲。 但 Javascript 性能优化绝不是一种书面的技术,Nicholas 的技术演进列出了10条...

    JavaScript 圣经第5版-Javascript编程宝典--黄金版 .rar

    This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include ...

    JavaScript Programmers Reference

    who are just learning the language and want to come up to speed quickly. In either case we assume you have at least a basic background in programming. Chapter 1, in particular, assumes you are coming...

    developing windows store apps with html5 and javascript

    up to speed by starting at the basic HTML5 structure, introducing semantic elements and continues with an extensive outline of styling concepts with CSS3. I found this quite useful as I always again ...

    JavaScript 提升运行速度之循环篇 译文

    原文标题:Speed up your JavaScript, Part 1 原文作者:Nicholas C. Zakas 在我 上一篇帖子 (译文 ) 中,谈到了各个浏览器究竟会在什么情况下弹出脚本失控提示,对于Internet Explorer 来说,当浏览器执行了数量...

    PhoneGap: Beginner’s Guide

    You will find plenty of fully explained code and ample screenshots in the book to ease and speed up your understanding. This book is for developers, ideally with web development experience, who are ...

    PhoneGap Beginners Guide Sep 2011

    You will find plenty of fully explained code and ample screenshots in the book to ease and speed up your understanding. This book is for developers, ideally with web development experience, who are ...

    Beginning JavaScript 4th Edition Oct 2009

    Continuing in the superlative tradition of the first three editions, Beginning JavaScript, Fourth Edition, gets you up to speed on all the new advances in JavaScript development. Beginning JavaScript...

    ReactJS.Blueprints.1785886541

    Learn how to speed up your development process and save valuable time Work though step-by-step tutorials that provide easy-to-understand solutions to real-world problems Book Description The ...

    React.Native.Blueprints.epub

    Use external modules to speed up the development and maintenance of your projects Explore the different UI and code patterns to be used for iOS and Android Understand the best practices which can be ...

Global site tag (gtag.js) - Google Analytics