推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
thautwarm
V2EX  ›  Python

世界上目前唯一的兼容 C API 的 Python JIT

  •  
  •   thautwarm ·
    thautwarm · Sep 19, 2019 · 6112 views
    This topic created in 2611 days ago, the information mentioned may be changed or developed.

    REPO: https://github.com/thautwarm/restrain-jit

    README 是个简单提速 50 倍的 demo,复杂的有难度的工作基本都做完了(除了生成器和异步,关键字参数调用之类的)。

    只要实现对标 python 的抽象层py_apis.py

    实现 julia 的即可:

    py_apis.jl

    我目前实现了 py_iter, py_next, py_add

    欢迎大家来交 PR~

    13 replies  •  2019-10-15 07:54:54 +08:00
    snBDX1b0jJM4ogKd
    snBDX1b0jJM4ogKd
    Sep 19, 2019 via Android
    1
    厉害,有时间了解下实现
    thautwarm
    thautwarm
    OP
    Sep 19, 2019 via Android
    2
    @cs010 嗯哼。README 里有张原理流程图,点和线都有代码链接
    azcvcza
    azcvcza
    Sep 19, 2019
    3
    虽然看不懂,但是觉得很厉害的样子
    TuxcraFt
    TuxcraFt
    Sep 19, 2019❤️1
    4
    要不要来给个 star ?
    xiaoxuxu
    xiaoxuxu
    Sep 19, 2019
    5
    厉害了。这个是没有 GIL 的么?
    thautwarm
    thautwarm
    OP
    Sep 19, 2019
    6
    @xiaoxuxu 非 python 的数据结构可以不用 gil。python object 的__next__需要 gil。

    正打算提供一些非 python 对象的数据构造器,比如这里: https://github.com/thautwarm/restrain-jit/issues/5
    bilibilifi
    bilibilifi
    Sep 20, 2019 via iPhone❤️1
    7
    哎,早点发现就好了。刚刚才用 cython 重构完...
    thautwarm
    thautwarm
    OP
    Sep 20, 2019 via Android
    8
    @bilibilifi hahaha, 心疼一下。不过我这个 jit 离上线 pypi 还有一个月,所以 cython 重构也是有必要的。而且我这个 jit 启动时间比较久,不适合脚本任务; cython 编译后没有启动开销
    pythonee
    pythonee
    Oct 14, 2019
    9
    膜拜大神呀,楼主专业是编程语言?
    thautwarm
    thautwarm
    OP
    Oct 14, 2019 via Android
    10
    @pythonee 是的
    hlyang1992
    hlyang1992
    Oct 14, 2019
    11
    @thautwarm 我以前试过 Julia, 启动也很慢,是不是 jit 相关的都不可避免启动开销?
    thautwarm
    thautwarm
    OP
    Oct 14, 2019
    12
    @hlyang1992 不是所有 jit 都慢, 但 julia 因为有一些非常 nb 的东西所以启动慢, 运行时编译也慢.

    比如有个说法是, julia 是 jaot. 这个是突出它运行时的优化很笨重, 分析的东西很多.
    hlyang1992
    hlyang1992
    Oct 15, 2019 via iPhone
    13
    @thautwarm Julia 加载包时非常慢,而且还不能编译,感觉体验很差,不知道大家为什么用的这么开心。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2472 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 12:14 · PVG 20:14 · LAX 04:14 · JFK 07:14
    ♥ Do have faith in what you're doing.