gonum/plot

vg/vgpdf: multiple canvas unecessarily rebuild same fonts

sbinet opened this issue · 0 comments

while running a monitoring program that analyzes about 6G of data and produces plots, I noticed half the real time was stemming from producing ~100 plots (PDF).

digging a bit, I noticed a few suboptimal behaviour on the gofpdf side:

but also a bigger part coming from vg/vgpdf that recreates the pdf fonts (makeFont) over and over: one per vgpdf.Canvas.
we probably need to create a per-package cache that the vgpdf.Canvas.fonts cache would build upon.