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

Improve tests’ speed #1548

Merged
merged 5 commits into from
Jan 24, 2022
Merged

Improve tests’ speed #1548

merged 5 commits into from
Jan 24, 2022

Conversation

liZe
Copy link
Member

@liZe liZe commented Jan 24, 2022

The goal of this pull request is to improve WeasyPrint’s speed, using tests for profiling. Tests are a good way to improve small documents’ rendering speed, as most of the unit tests render very small documents.

The main improvements of this pull request are:

  • removed some font tables that are useless in PDF files, to save a small amount of file size but possibly a large amount of time (because fonts are subset, see Performance issue on v53 with large font #1457)
  • avoid useless deep copy of page counters for each document

This pull request saves between 10% and 20% of the total time spent in tests.

liZe added 5 commits January 23, 2022 18:52
Counter styles keys are strings, and values are dicts. These dicts are only
created when new counters are created, but they are never modified, so there’s
no need to deepcopy them.

Tests are ~15% faster on my computer. We should get an interesting boost for
very small documents too.
@liZe liZe added the performance Too slow renderings label Jan 24, 2022
@liZe liZe added this to the 55.0 milestone Jan 24, 2022
@liZe liZe merged commit f993dfb into master Jan 24, 2022
@liZe liZe deleted the fast-tests branch January 24, 2022 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Too slow renderings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant