Cython
简单的加密python
代码(防君子不防小人),或者是要热点提速,可以考虑cython
。常用的命令如下。
python
代码编译成so
cat setup.py
from distutils.core import setup
from Cython.Build import cythonize
setup(
name = 'xxx decrypt lib',
ext_modules = cythonize("xxx.pyx"),
)
python setup.py build_ext --inplace
参考:http://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html
python
优化热点代码
优化热点之前,一定先用profile
看看,热点代码是哪段。别瞎优化。
.c
文件, 重写算法