简体   繁体   English

Cython,调用 shell 命令。 性能提升

[英]Cython, invoking shell comand. Performance gain

My question is simple.我的问题很简单。 Is there anything to gain by using Cython vs pure Python to invoke shell commands or any other binary executables present on the OS?使用 Cython 与纯 Python 调用 shell 命令或操作系统上存在的任何其他二进制可执行文件有什么好处?

As opposed to just os.system() ?而不仅仅是os.system() Not really.并不真地。

The implementation of os.system() is basically (with some macros removed): os.system()的实现基本上是(删除了一些宏):

static long
os_system_impl(PyObject *module, const Py_UNICODE *command)
{
    long result;

    if (PySys_Audit("os.system", "(u)", command) < 0) {
        return -1;
    }

    result = _wsystem(command);
    return result;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM