Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fgelm01 opened this issue May 14, 2024 · 10 comments
Open

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

fgelm01 opened this issue May 14, 2024 · 10 comments

Comments

@fgelm01
Copy link
Contributor

fgelm01 commented May 14, 2024

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
Copy link
Contributor Author

fgelm01 commented May 14, 2024

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
Copy link
Owner

spirali commented May 14, 2024

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
Copy link
Contributor Author

fgelm01 commented Jul 11, 2024

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
Copy link
Owner

spirali commented Jul 12, 2024

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
Copy link
Contributor Author

fgelm01 commented Jul 20, 2024

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

@spirali
Copy link
Owner

spirali commented Jul 21, 2024

I have not received your email.

@fgelm01
Copy link
Contributor Author

fgelm01 commented Jul 21, 2024

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

@spirali
Copy link
Owner

spirali commented Jul 22, 2024

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
Copy link
Owner

spirali commented Jul 24, 2024

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.

@spirali
Copy link
Owner

spirali commented Oct 3, 2024

FYI: I have integrate new upstream crates that fixes a problem with subsetting. In "main" branch (unrelased yet), it decrease the size of PDF to 6.8MB and it is about 15% faster. I will make new release in few days.

Btw: So far, I did not find a definite way to solve rendering speed with the current renderer but I am experimenting with Parley and it seems as a way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants