fluent / fluent/fluent-logger-python

Use actual bytesarray/memoryview instead of bytes concatenation

Offen
#113 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
457
Forks
138
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
backend
Issue-Typ
Refactoring
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.