-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48bba1d
commit 910e0cd
Showing
4 changed files
with
72 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[原文:PCRE Performance Project](https://zherczeg.github.io/sljit/pcre.html) | ||
|
||
## PCRE性能优化 | ||
|
||
### 简介 | ||
|
||
`PCRE-sljit`项目的目的是提高[pcre](http://www.pcre.org/) 库的模式匹配速度。 | ||
|
||
该项目通过使用`sljit`来完成的,`sljit`是一个即时(JIT)编译库, | ||
用于从`pcre_compile()`生成的内部字节码表示转换机器码。 | ||
|
||
`PCRE-sljit`在通用模式上提供了与基于`DFA`的引擎(如`re2`)相似的匹配速度,但仍然保持`PERL`兼容性。 | ||
|
||
该功能已经作为`PCRE 8.20`及以上版本的一部分发布,`JIT`在`8.32`中得到了很大的改进,并且引入了一个原生的接口。 | ||
|
||
### 关于性能优化 | ||
|
||
只有在匹配正则表达式占总运行时至少`4-5`%的情况下,`PCRE-JIT`才会对您有所帮助。 | ||
|
||
否则,由于二进制布局的改变,可能不会有任何性能提高(或者会看到性能下降) | ||
|
||
不幸的是,由于`CPU`缓存布局、分支预测机制等原因,插入`nops`可以增加或减少最多可达`3%`的程序运行时间,。 | ||
|
||
在人为干预下,运行时间的变化幅度可能更大(例如±50%)。当任何函数被修改时,即使改变很小,它也会影响整个二进制布局, | ||
因为其他函数的入口偏移量也会被改变(特别是那些被链接器放在可执行文件中该函数之后的函数)。 | ||
因此,当匹配正则表达式的比例非常低时,在使用`PCRE-JIT`时,您可能会遇到性能的轻微下降。 | ||
|
||
### Usage | ||
|
||
TODO | ||
|
||
### Motivation | ||
|
||
### 工作原理 | ||
|
||
### Why is it faster? | ||
|
||
### 编译时开销 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters