fluent / fluent/fluent-logger-python
Use actual bytesarray/memoryview instead of bytes concatenation
- 主要语言
- Python
- 星标
- 457
- 派生
- 138
- PR 合并指标
- 30 天内没有已合并 PR
描述
Bytes concatenation such as this is extremely wasteful and is never a good idea.
https://github.com/fluent/fluent-logger-python/blob/master/fluent/sender.py#L137
```python
# buffering
if self.pendings:
self.pendings += bytes_
bytes_ = self.pendings
```
Python has mutable buffers that should be used to ensure that the objects aren't created needlessly putting pressure on GC and wasting CPU with double-copy concatenation.
贡献指南
这个仓库没有索引到贡献指南
调研方向
Start in fluent/sender.py at line 137 and trace the buffering path around self.pendings. Read the surrounding sender implementation to compare the proposed bytearray or memoryview approach with the current concatenation. Done means buffered sends no longer repeatedly concatenate bytes while preserving the sender's existing behavior.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend
- Issue 类型
- 重构
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100