1、If a method can be static, declare it static. Speed improvement is by a factor of 4.
1、如果一个函数可以声明为静态的,那么就用静态的,速度是改进的一个因素4.
2、# Avoid magic like __get, __set, __autoload
2、避免使用__get, __set, __autoload等魔术函数
3、require_once() is expensive
3、require_once()是相当昂贵的。
4、Use full paths in includes and requires, less time spent on resolving the OS paths.
4、用include和require时,尽量用全路径,可以减少花在解决OS路径的时间
5、If you need to find out the time when the scrīpt started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()
5、如果你需要知道一个脚本的开始运行时间,用 $_SERVER[’REQUEST_TIME’]比用time()要好
6、See if you can use strncasecmp, strpbrk and stripos instead of regex
6、如果可以用strncasecmp, strpbrk and stripos就别用正则
7、preg_replace is faster than str_replace, but strtr is faster than preg_replace by a factor of 4
7、preg_replace比str_replace要快,但是strtr比preg_replace更快
8、If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.
一些函数,比如字符串替换函数,接受数组和单个字符做为参数,并且如果你的参数列表不是很长,考虑写一些冗余替换语句,每次传送一个字符,代替一行代码接受数组做为查找和替换的参数。
9、Error suppression with @ is very slow.
9、禁止错误输出符号@是非常慢的。
10、$row[’id’] is 7 times faster than $row[id]
10、、$row[’id’]比 $row[id]快7倍
11、Error messages are expensive
11、错误信息是非常昂贵的
12、Do not use functions inside of for loop, such as for ($x=0; $x 12、不要在循环内部使用函数,比如: for ($x=0; $x
对于模板,你是否在用smarty?这可能是保证把最经常访问的页面缓存起来的最快的方法了。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器

WebStorm Mac版
好用的JavaScript开发工具

mPDF
mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

记事本++7.3.1
好用且免费的代码编辑器