推荐学习书目
› 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
zhoudaiyu
V2EX  ›  Python

Python 哪个 json 库反序列化最快?

  •  
  •   zhoudaiyu · Dec 28, 2020 via iPhone · 5519 views
    This topic created in 2154 days ago, the information mentioned may be changed or developed.

    测了一下 ujson 比自带 json 快了不少,但是还是满足不了接口速度的要求,有没有更快一点的库?只考虑反序列化

    15 replies  •  2021-01-01 12:01:05 +08:00
    codebigbang
    codebigbang
    Dec 28, 2020 via Android
    1
    场景是否支持先把数据切块?
    zhoudaiyu
    zhoudaiyu
    OP
    Dec 28, 2020 via iPhone
    2
    @codebigbang 切片么就是
    NBNPC
    NBNPC
    Dec 28, 2020
    3
    VYSE
    VYSE
    Dec 28, 2020
    4
    只考虑反序列化: msgpack
    ClericPy
    ClericPy
    Dec 28, 2020
    5
    cjson ojson

    不过有一些 by design 的坑自己得注意点... 记得还有个更快的, 但是不流行就懒得去搜了, 感兴趣可以随便搜搜 fastest python json
    ClericPy
    ClericPy
    Dec 28, 2020
    6
    打错.. orjson...
    gainsurier
    gainsurier
    Dec 28, 2020
    7
    考虑绝对性能的话,可以试试 simdjson 和 rapidjson 或者 yyjsonde c 接口封装。
    abersheeran
    abersheeran
    Dec 28, 2020
    8
    讨论出结果了麻烦敲我一下,刚好也需要用到有性能需求的 JSON 模块。
    so1n
    so1n
    Dec 29, 2020
    9
    目前只有 python 在用的话我是用 orjson 如果双端可以一起改的 则用 msgpack
    yingbo
    yingbo
    Dec 29, 2020
    10
    用过 ujson,比标准库的快很多。楼上提到的别的没用过。
    momo1999
    momo1999
    Dec 29, 2020
    11
    只用 ujson 替换过内置的
    nonduality
    nonduality
    Dec 29, 2020
    12
    我也需要高速 JSon 模块,但在 Alpine Linux 下,因 orjson 是 rust 写的不方便编译,ujson 不能用 musl 库。

    不知有哪位高人能把 yyjson 封装成 python 模块,yyjson 是用 ansi C 写的,理论上能适应 Alpine Linux
    Arthur2e5
    Arthur2e5
    Dec 29, 2020
    14
    > @nonduality ujson 不能用 musl 库。

    不该啊,这群人三年前不是还修过一个 alpine 崩溃的 bug ?
    https://github.com/ultrajson/ultrajson/pull/281

    有问题再开一个就是了。
    nonduality
    nonduality
    Jan 1, 2021
    15
    @icyalala Good! 多谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1722 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 16:13 · PVG 00:13 · LAX 08:13 · JFK 11:13
    ♥ Do have faith in what you're doing.