跳转到主要内容

Python的一个快速、无拷贝的缓冲区

项目描述

https://travis-ci.org/alex/zero_buffer.png?branch=master

zero_buffer 是Python的一个高性能、无拷贝的字节缓冲区实现。

文档 在ReadTheDocs上可用。

from zero_buffer import Buffer

# Create a buffer which has space for 8192 bytes.
b = Buffer.allocate(8192)
with open(path, "rb") as f:
    # Read up to 8192 bytes from the file into the buffer
    b.read_from(f.fileno())
# Create a read-only view of the buffer, this performs no copying.
view = b.view()
# Split the view on colons, this returns a generator which yields sub-views
# of the view.
for part in view.split(b":"):
    print(part)

zero_buffer 适用于Python 2.6、2.7、3.2、3.3和PyPy。

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源代码分发

zero_buffer-0.5.1.tar.gz (20.3 kB 查看哈希)

源代码

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页