易截截图软件、单文件、免安装、纯绿色、仅160KB

[翻译]High Performance JavaScript(017)

A Note on Benchmarking  测试基准说明
    Because a regex's performance can be wildly different depending on the text it's applied to, there's no straightforward way to benchmark regexes against each other. For the best result, you need to benchmark your regexes on test strings of varying lengths that match, don't match, and nearly match.
    因为正则表达式性能因应用文本不同而产生很大差异,没有简单明了的方法可以测试正则表达式之间的性能差别。为得到最好的结果,你需要在各种字符串上测试你的正则表达式,包括不同长度,能够匹配的,不能匹配的,和近似匹配的。
    That's one reason for this chapter's lengthy backtracking coverage. Without a firm understanding of backtracking, you won't be able to anticipate and identify backtracking-related problems. To help you catch runaway backtracking early, always test your regexes with long strings that contain partial matches. Think about the kinds of strings that your regexes will nearly but not quite match, and include those in your tests.
    这也是本章长篇大论回溯的原因之一。如果没有确切理解回溯,就无法预测和确定回溯相关问题。为帮助你早日把握回溯失控,总是用包含特殊匹配的长字符串测试你的正则表达式。针对你的正则表达式构思一些近似但不能完全匹配的字符串,将他们应用在你的测试中。
More Ways to Improve Regular Expression Efficiency  提高正则表达式效率的更多方法
    The following are a variety of additional regex efficiency techniques. Several of the points here have already been touched upon during the backtracking discussion.
    下面是一写提高正则表达式效率的技术。几个技术点已经在回溯部分讨论过了。
Focus on failing faster
关注如何让匹配更快失败
    Slow regex processing is usually caused by slow failure rather than slow matching. This is compounded by the fact that if you're using a regex to match small parts of a large string, the regex will fail at many more positions than it will succeed. A change that makes a r


相关文档:

javascript继承方式之二

2、原型方式写类,原型方式继承
core js自身的对象系统就是采用原型方式(prototype based)继承的。或者说core
js没有采用常见的类继承(class
based)系统,而是使用原型继承来实现自己的对象系统。工作中我们也可以用原型方式来实现继承,代码复用以构建自己的功能模块。
/**
* 父类Polygon:多边形
*
*/
functio ......

JavaScript基础知识1

Javascript数据类型
由于javascript是弱类型语言,即定义变量时不必声明其类型
。但这并不意味着变量没有类型。因为赋值时会自动匹配数据类型!
目前用到的基本数据类型
number
boolean
string
var i
i="test";//这时i就成了string类型
var i
i=4;//这时i就成了number类型
常用对象类型<object> ......

[翻译]High Performance JavaScript(011)

Repaints and Reflows  重绘和重排版
    Once the browser has downloaded all the components of a page—HTML markup, JavaScript, CSS, images—it parses through the files and creates two internal data structures:
    当浏览器下载完所有页面HTML标记,JavaScri ......

[翻译]High Performance JavaScript(012)

第四章  Algorithms and Flow Control  算法和流程控制
    The overall structure of your code is one of the main determinants as to how fast it will execute. Having a very small amount of code doesn't necessarily mean that it will run quickly, and having a large amount of code ......

[翻译]High Performance JavaScript(014)

Recursion Patterns  递归模式
    When you run into a call stack size limit, your first step should be to identify any instances of recursion in the code. To that end, there are two recursive patterns to be aware of. The first is the straightforward recursive pattern represented ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号