[PyPy][1]作为CPython的高性能替代方案,目前已经十分成熟,得益于JIT等技术的应用,多数场景下PyPy都具有更好的性能。以通过正则对Nginx日志进行解析为例,对300G数据进行处理,PyPy对比原生Python能得到2.5倍以上的性能提升:
Slot time(mins) | Read(%) | Write(%) | User(%) | MB/s | Record/s | |
---|---|---|---|---|---|---|
Python 2.6 | 2412.76 | 3.17% | 32.21% | 64.61% | 2.07 | 1741.74 |
PyPy 2.3 | 869.37 | 9.01% | 87.13% | 3.85% | 5.69 | 4809.06 |