phpdave11 / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/phpdave11/gofpdf
MIT License
214 stars 42 forks source link

all: optimize rgbColorValue #16

Closed sbinet closed 3 years ago

sbinet commented 3 years ago

This CL introduces a per-document buffer to build color strings.

name        old time/op    new time/op    delta
RGB_grg-8      808ns ± 0%     576ns ± 0%  -28.66%  (p=0.000 n=17+18)
RGB_gray-8     779ns ± 0%     584ns ± 0%  -25.01%  (p=0.000 n=18+18)
RGB_full-8     746ns ± 1%     568ns ± 1%  -23.89%  (p=0.000 n=19+19)

name        old alloc/op   new alloc/op   delta
RGB_grg-8      64.0B ± 0%     24.0B ± 0%  -62.50%  (p=0.000 n=20+20)
RGB_gray-8     48.0B ± 0%     24.0B ± 0%  -50.00%  (p=0.000 n=20+20)
RGB_full-8     48.0B ± 0%     24.0B ± 0%  -50.00%  (p=0.000 n=20+20)

name        old allocs/op  new allocs/op  delta
RGB_grg-8       5.00 ± 0%      1.00 ± 0%  -80.00%  (p=0.000 n=20+20)
RGB_gray-8      4.00 ± 0%      1.00 ± 0%  -75.00%  (p=0.000 n=20+20)
RGB_full-8      4.00 ± 0%      1.00 ± 0%  -75.00%  (p=0.000 n=20+20)
sbinet commented 3 years ago

ping?

sbinet commented 3 years ago

FYI, this has been integrated into https://github.com/go-pdf/fpdf.