spirali / nelsie

Framework for Creating Slides
MIT License
39 stars 4 forks source link

PDF size increased between v0.6 and v0.8 #32

Open fgelm01 opened 3 months ago

fgelm01 commented 3 months ago

The size of the generated PDF for the same input increased between version 0.6 and 0.8. With 0.6, the pdf size was 12MB. With 0.8, it is 19MB.

I also noticed that some fonts look different now.

v0.6: image v0.8: image

fgelm01 commented 3 months ago

Update: Looks like the font difference is a consequence of weight being interpreted differently. A value of 550 was enough for 0.6 to produce bold for this font, but now anything below 700 produces non-bold.

spirali commented 3 months ago

Can you please share your presentation (at least privately)? My internal benchmark shows that the new version produce slightly smaller slides then previous versions (and much smaller slides if you heavily reuse raster images on slides).

I will investigate what have changed in font rendering wrt. font weight

fgelm01 commented 1 month ago

Hello. After a long time, I have an update for you.

Nelsie Version PDF Size Generation Time PDF
0.6.0 12MB 5.14s v060pdf
0.7.0 23MB 5.35s v070.pdf
0.8.0 22MB 8.32s v080.pdf
0.11.0 17MB 26.44s v0110.pdf

All documents were generated from identical Python input. The only variable was the venv with different versions of nelsie installed.

spirali commented 1 month ago

Thank you for your update. Can you please share the source code with me? I would like to profile it, increase to 26s is really unexpected.

fgelm01 commented 1 month ago

I have emailed you the source for my presentation. Please let me know if you got it.

spirali commented 1 month ago

I have not received your email.

fgelm01 commented 1 month ago

How can I privately share the source code for my presentation with you?

spirali commented 1 month ago

I have found your email, I am sorry.

I can confirm the performance regression (in my case v0.11 is 2x slower then v0.7). I will try to investigate the problem. Thank you for your slides!

spirali commented 1 month ago

I did some profiling and measurements and it seems that there are some regressions in text rendering and text size computing. Your slides are also quite heavily using text_anchors that needs some extra text computing so it amplifies the effect.

I am going to implement some optimizations around text rendering so I hope it helps. I cannot revert to the previous text processing as API of upstream crates were changed.

The increased size of slides is still quite mystery for me, and I still do not have final conclusion.