cython对discord.py各个部分的加速
discord-ext-speedups的Python项目详细描述
不协调的外部加速
cython为discord.py的各个部分加速
安装
pip install discord-ext-speedups
用法
importdiscordfromdiscord.extimportspeedupsspeedups.install()
此MyKek将所有可用的C扩展插件插入到DISCOR.PY中,替换现有的扩展。最好在import discord
之后立即完成。要只安装特定的修补程序,请将名称传递给install()
。有关更多信息,请参阅下面的参考部分。
要恢复补丁,只需调用speedups.uninstall()
即可将所有模块恢复正常。此函数还将特定的模块名称作为参数。note:在使用此库更改的模块或对象时,可能应该避免这样做。
可用修补程序
copus
用于libopus的cython绑定。这是在cython写的一个实验,并没有产生太多的加速。一个基准测试显示,速度提高了10%,但这也只相当于这个调用的总时间窗口(20毫秒/帧)的0.5%。
参考
install(*install_modules, ignore=False)
替换模块中的修补程序。
*install_modules
(str
)要安装的模块名。可用模块名的列表可以在上面找到,或者通过调用
get_available_patches()
。ignore
(bool
)如果为true,则安装所有可用的模块,但指定模块除外。
返回模块名的list[str]
。
uninstall(*uninstall_modules, ignore=False)
撤消修补并还原原始模块。
*uninstall_modules
(str
)要卸载的模块名称。通过调用
get_installed_patches()
,可以找到已安装模块名的列表。ignore
(bool
)如果为true,则卸载所有可用的模块,但给定模块除外。
get_available_patches()
返回可用模块名的tuple[str]
。
get_installed_patches()
返回已安装模块名的tuple[str]
。
要求
- Python3.6.4+
discord.py
从源代码编译需要:
cython
0.27.3