matplotlib / matplotlib/ipympl

Optimizations

Offen
#103 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Jupyter Notebook
Sterne
1.7k
Forks
234
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I feel like there could be some optimizations concerning the image update.

1. We should draw binary data directly on the canvas using:
```javascript
context.putImageData(binary_data);
```
instead of creating a Blob that is png encoded. That would also allow the back-end to not waste time encoding into png (if that is possible).

2. I feel like the "diff" computation should actually be slower than sending the full image, as it needs an extra computation of "which pixels actually needs a redraw?": https://github.com/matplotlib/matplotlib/blob/5fc44eea64a57ab1c6d236cf7c71906c9d40e6f6/lib/matplotlib/backends/backend_webagg_core.py#L190-L195.
Plus, we are still sending a full image. Maybe the png encoding does some compression if lots of pixels are transparent? If that is not the case, we are still sending the same amount of data.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem referenzierten Bildaktualisierungscode in matplotlib/backends/backend_webagg_core.py und verfolge den entsprechenden Einstiegspunkt für Canvas-Aktualisierungen in ipympl. Vergleiche den vorgeschlagenen Binärdatenpfad mit den aktuellen PNG- und Diff-Pfaden und definiere Benchmarks und Akzeptanzkriterien, bevor du eine der beiden Seiten änderst.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, python
Bereich
backend, frontend, performance
Issue-Typ
Refactoring
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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