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 performance #922

Merged
merged 39 commits into from
Sep 3, 2019
Merged

Improve performance #922

merged 39 commits into from
Sep 3, 2019

Conversation

liZe
Copy link
Member

@liZe liZe commented Aug 15, 2019

Also fix #700.

liZe and others added 30 commits July 5, 2019 17:33
Float clearance requires to calculate the line minimum width and height before
setting the linebox position. When there are no floating boxes in the context,
there's no need to calculate these sizes.

We thus avoid a call to inline_min_content_width per text line. This call
required a lot of time as it needed to go through the whole line breaking
algorithm to render the first word.

We save 15% of the rendering time when generating our Odyssey sample.
Spliting the line again is useless here.
As attributes of this object is accessed many times per element, it improves
the overall speed in a significant way. We save between 1 and 2 percents with
html5 sample for example.
Going through the whole specified properties dict can be long, and calling
"startswith" on each name is even longer. Setting both computed and specified
values at the same times avoids an extra loop in compute.
As this loop is called for each anonymous box, avoiding a text formatting makes
a significant difference.
Setting text is slow and should be avoided when possible. We should probably
avoid get_first_line too and keep the original one here.
This partially reverts a27146c.
It used to be really slow, at least on large inline containers.
It saves a lot of memory for very long paragraphs with no decoration style.
The device_size parameter was passed to many layout features, but it was only
used to set default size of replaced boxes with no implicit or explicit size
set. As this case is really rare for printed documents, and as it's also rare
to have printed supports that small, we can remove this "feature".

Moreover, in CSS3-images, another definition called "default object size" is
used to set replaced box size when no size is defined. This size doesn't seem
to be defined for images.
In the 2014 version of CSS Syntax Module Level 3 [1], meeting an EOF character
before the end of a string would just return the string token. In the 2019
candidate recommendation [2], this behavior must raise a parse error.

This commit fixes a test that was relying on the older behavior.

TinyCSS2 will follow the new specification from version 1.1.0.

[1] https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/#consume-a-string-token
[2] https://www.w3.org/TR/2019/CR-css-syntax-3-20190716/#consume-string-token
There used to be a problem with WRAP_CHAR method of Pango, but it's fixed. As
nothing is said in Pango's Changelog, the probem may have been in our heads,
and that wouldn't be surprising at all.
FakeHTML actually reads data from a file.
This TODO has been fixed with #771.
@liZe liZe added this to the 49 milestone Aug 15, 2019
@Tontyna
Copy link
Contributor

Tontyna commented Aug 16, 2019

👍 for the cleanups

liZe added 2 commits August 17, 2019 11:06
We can now get style in the parent loop, avoiding a large number of calls to
setdefault.
@liZe liZe added the performance Too slow renderings label Sep 3, 2019
@liZe liZe marked this pull request as ready for review September 3, 2019 10:29
@liZe liZe merged commit 074d147 into master Sep 3, 2019
@liZe liZe deleted the perf branch September 4, 2019 13:50
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.

Implement ::marker
3 participants