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

Streamline figure markdown #1236

Merged
merged 40 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a5f43e9
Move figure markup to a macro
tunetheweb Aug 20, 2020
ead1a46
Revert test_status_codes as opened under separate PR
tunetheweb Aug 20, 2020
fc2dadf
Remove unnecessary defaults
tunetheweb Aug 20, 2020
6af3308
Fix typo
tunetheweb Aug 20, 2020
c7e3f29
Fix ebook
tunetheweb Aug 20, 2020
07014e7
Avoid duplication of code
tunetheweb Aug 21, 2020
a53b688
Merge branch 'main' into streamline_figure_markdown
tunetheweb Aug 24, 2020
0e048d4
Merge branch 'main' into streamline_figure_markdown
tunetheweb Aug 25, 2020
d57f926
Review Feedback
tunetheweb Aug 25, 2020
17d4403
Review feedback
tunetheweb Aug 25, 2020
76a4d8b
Fix linting
tunetheweb Aug 25, 2020
9037084
Oh shut up linter!
tunetheweb Aug 25, 2020
95a0af6
Update src/templates/base/2019/base.html
tunetheweb Aug 25, 2020
c80431b
Merge branch 'main' into streamline_figure_markdown
tunetheweb Aug 25, 2020
e1b7e4f
Refactor and fix ebooks
tunetheweb Aug 26, 2020
a8d379c
Increment figure ids
tunetheweb Aug 26, 2020
9c22978
Figure references and figure_lock logic
tunetheweb Aug 27, 2020
bead9c5
Linting errors
tunetheweb Aug 27, 2020
2f20ca1
Revert formating changes
tunetheweb Aug 27, 2020
bcdf0a4
Remove duplicated formatting
tunetheweb Aug 27, 2020
0cbabd6
Merge branch 'main' into streamline_figure_markdown
rviscomi Sep 4, 2020
33e54b5
Remove figref code
tunetheweb Sep 4, 2020
794709f
Add sheets and SQL params (not used currently)
tunetheweb Sep 14, 2020
70c3bbb
Merge branch 'main' into streamline_figure_markdown
tunetheweb Sep 14, 2020
d1cbf1b
Correct typo
tunetheweb Sep 14, 2020
63d5b7c
Merge branch 'main' into streamline_figure_markdown
tunetheweb Sep 16, 2020
5c2b08a
Remove figure_lock
tunetheweb Sep 16, 2020
e2e25cb
Handle links, video and ebook
tunetheweb Sep 17, 2020
0d44c0d
Linting fixes
tunetheweb Sep 17, 2020
5258368
Linting fix
tunetheweb Sep 17, 2020
92e2604
Fix linting
tunetheweb Sep 17, 2020
d4c896f
Linting fixes
tunetheweb Sep 17, 2020
b2f245b
Merge branch 'main' into streamline_figure_markdown
tunetheweb Sep 20, 2020
2a26a8f
Convert 2019 en chapters to new format
tunetheweb Sep 20, 2020
777231e
Migrate Spanish chapters to new format
tunetheweb Sep 20, 2020
2aa07e7
French chapters migration
tunetheweb Sep 20, 2020
5897694
Move Japanese chapters to new format
tunetheweb Sep 21, 2020
2f7be27
Chinese plus cleanup
tunetheweb Sep 21, 2020
e41e936
Clean up
tunetheweb Sep 21, 2020
62d5a82
Remove old figure if logic
tunetheweb Sep 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 93 additions & 63 deletions src/content/en/2019/accessibility.md

Large diffs are not rendered by default.

299 changes: 175 additions & 124 deletions src/content/en/2019/caching.md

Large diffs are not rendered by default.

341 changes: 198 additions & 143 deletions src/content/en/2019/cdn.md

Large diffs are not rendered by default.

324 changes: 193 additions & 131 deletions src/content/en/2019/cms.md

Large diffs are not rendered by default.

185 changes: 111 additions & 74 deletions src/content/en/2019/compression.md

Large diffs are not rendered by default.

495 changes: 258 additions & 237 deletions src/content/en/2019/css.md

Large diffs are not rendered by default.

309 changes: 186 additions & 123 deletions src/content/en/2019/ecommerce.md

Large diffs are not rendered by default.

232 changes: 140 additions & 92 deletions src/content/en/2019/fonts.md

Large diffs are not rendered by default.

119 changes: 67 additions & 52 deletions src/content/en/2019/http2.md

Large diffs are not rendered by default.

244 changes: 122 additions & 122 deletions src/content/en/2019/javascript.md

Large diffs are not rendered by default.

159 changes: 96 additions & 63 deletions src/content/en/2019/markup.md

Large diffs are not rendered by default.

453 changes: 265 additions & 188 deletions src/content/en/2019/media.md

Large diffs are not rendered by default.

148 changes: 81 additions & 67 deletions src/content/en/2019/mobile-web.md

Large diffs are not rendered by default.

67 changes: 35 additions & 32 deletions src/content/en/2019/page-weight.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,25 @@ There were three really important takeaways from this research:

2. **The number of images on a page was the second greatest predictor of conversions.** Sessions in which users converted had 38% fewer images than in sessions that didn't convert.

<figure>
<a href="/static/images/2019/page-weight/ch18_fig1_conversion_difference.png">
<img src="/static/images/2019/page-weight/ch18_fig1_conversion_difference.png" alt="Figure 1. Converted sessions vs non-converted sessions." aria-labelledby="fig1-caption" aria-describedby="fig1-description" width="600" height="432">
</a>
<div id="fig1-description" class="visually-hidden">Chart showing 19 converted sessions vs. 31 non-converted sessions</div>
<figcaption id="fig1-caption">Figure 1. Converted sessions vs non-converted sessions.</figcaption>
</figure>
{{ figure_markup(
image="ch18_fig1_conversion_difference.png",
caption="Converted sessions vs non-converted sessions.",
description="Chart showing 19 converted sessions vs. 31 non-converted sessions",
width=600,
height=432
)
}}

3. **Sessions with more scripts were less likely to convert.** What's really fascinating about this chart isn't just the sharp drop-off in conversion probability after about 240 scripts. It's the long tail that demonstrates how many retail sessions contained up to 1,440 scripts!

<figure>
<a href="/static/images/2019/page-weight/ch18_fig2_conversion_graph.jpg">
<img src="/static/images/2019/page-weight/ch18_fig2_conversion_graph.jpg" alt="Figure 2. Conversion rate dropping off as scripts increase." aria-labelledby="fig2-caption" aria-describedby="fig2-description" width="600" height="336">
</a>
<div id="fig2-description" class="visually-hidden">Chart showing conversion rate climbing up until 80 scripts, and then dropping off as scripts increase up to 1440 scripts.</div>
<figcaption id="fig2-caption">Figure 2. Conversion rate dropping off as scripts increase.</figcaption>
</figure>
{{ figure_markup(
image="ch18_fig2_conversion_graph.jpg",
caption="Conversion rate dropping off as scripts increase.",
description="Chart showing conversion rate climbing up until 80 scripts, and then dropping off as scripts increase up to 1440 scripts.",
width=600,
height=336
)
}}

Now that we've covered why page size and complexity matter, let's get into some juicy HTTP Archive stats so we can better understand the current state of the web and the impact of page bloat.

Expand Down Expand Up @@ -148,7 +150,7 @@ Roughly speaking, mobile sites are about 10% smaller than their desktop counterp
<td>4</td>
</tr>
</table>
<figcaption>Figure 3. Page weight on mobile broken down by resource type.</figcaption>
<figcaption>{{ figure_link(caption="Page weight on mobile broken down by resource type.") }}</figcaption>
</figure>

#### Desktop
Expand Down Expand Up @@ -210,7 +212,7 @@ Roughly speaking, mobile sites are about 10% smaller than their desktop counterp
<td>4</td>
</tr>
</table>
<figcaption>Figure 4. Page weight on desktop broken down by resource type</figcaption>
<figcaption>{{ figure_link(caption="Page weight on desktop broken down by resource type") }}</figcaption>
</figure>

### Page weight over time
Expand Down Expand Up @@ -276,7 +278,7 @@ Over the past year the median size of a desktop site increased by 434 KB, and th
<td>+1</td>
</tr>
</table>
<figcaption>Figure 5. Change in mobile page weight since 2018.</figcaption>
<figcaption>{{ figure_link(caption="Change in mobile page weight since 2018.") }}</figcaption>
</figure>

#### Desktop
Expand Down Expand Up @@ -338,7 +340,7 @@ Over the past year the median size of a desktop site increased by 434 KB, and th
<td>+1</td>
</tr>
</table>
<figcaption>Figure 6. Change in desktop page weight since 2018.</figcaption>
<figcaption>{{ figure_link(caption="Change in desktop page weight since 2018.") }}</figcaption>
</figure>

For a longer-term perspective on how page weight has changed over time, check out [this timeseries graph](https://httparchive.org/reports/page-weight#bytesTotal) from HTTP Archive. Median page size has grown at a fairly constant rate since the HTTP Archive started tracking this metric in November 2010 and the increase in page weight observed over the past year is consistent with this.
Expand Down Expand Up @@ -406,7 +408,7 @@ The median desktop page makes 74 requests, and the median mobile page makes 69.
<td>0</td>
</tr>
</table>
<figcaption>Figure 7. Mobile page requests broken down by resource type.</figcaption>
<figcaption>{{ figure_link(caption="Mobile page requests broken down by resource type.") }}</figcaption>
</figure>

#### Desktop
Expand Down Expand Up @@ -468,7 +470,7 @@ The median desktop page makes 74 requests, and the median mobile page makes 69.
<td>0</td>
</tr>
</table>
<figcaption>Figure 8. Desktop page requests broken down by resource type.</figcaption>
<figcaption>{{ figure_link(caption="Desktop page requests broken down by resource type.") }}</figcaption>
</figure>

### File formats
Expand Down Expand Up @@ -533,7 +535,7 @@ The preceding analysis has focused on analyzing page weight through the lens of
<td>78</td>
</tr>
</table>
<figcaption>Figure 9. Images file sizes on mobile broken down by image format.</figcaption>
<figcaption>{{ figure_link(caption="Images file sizes on mobile broken down by image format.") }}</figcaption>
</figure>

Some of these results, particularly those for GIFs, are really surprising. If GIFs are so small, then why are they being replaced by formats like JPG, PNG, and WEBP?
Expand All @@ -542,13 +544,14 @@ The data above obscures the fact that the vast majority of GIFs on the web are a

Further investigation into the data set revealed that 62% of GIFs are 43 bytes or smaller (43 bytes is the size of a transparent, 1x1 pixel GIF) and 84% of GIFs are 1 KB or smaller.

<figure>
<a href="/static/images/2019/page-weight/ch18_fig3_gif_cdf.png">
<img src="/static/images/2019/page-weight/ch18_fig3_gif_cdf.png" alt="Figure 10. Cumulative distribution function of GIF file sizes." aria-labelledby="fig10-caption" aria-describedby="fig10-description" width="600" height="330">
</a>
<div id="fig10-description" class="visually-hidden">Chart showing 25% of GIFs are 35 bytes or smaller (which is the optimal size of a 1x1 white GIF) and 62% of GIFs are 43 bytes or smaller (which is the optimal size of a 1x1 transparent GIF). This increases to just over 75% of GIFs being 100 bytes or less.</div>
<figcaption id="fig10-caption">Figure 10. Cumulative distribution function of GIF file sizes.</figcaption>
</figure>
{{ figure_markup(
image="ch18_fig3_gif_cdf.png",
caption="Cumulative distribution function of GIF file sizes.",
description="Chart showing 25% of GIFs are 35 bytes or smaller (which is the optimal size of a 1x1 white GIF) and 62% of GIFs are 43 bytes or smaller (which is the optimal size of a 1x1 transparent GIF). This increases to just over 75% of GIFs being 100 bytes or less.",
width=600,
height=330
)
}}

The tables below show two different approaches to removing these tiny images from the data set: the first one is based on images with a file size greater than 100 bytes, the second is based on images with a file size greater than 1024 bytes.

Expand Down Expand Up @@ -611,7 +614,7 @@ The tables below show two different approaches to removing these tiny images fro
<td>76.43</td>
</tr>
</table>
<figcaption>Figure 11. File size by image format for images > 100 bytes.</figcaption>
<figcaption>{{ figure_link(caption="File size by image format for images > 100 bytes.") }}</figcaption>
</figure>

#### File size by image format for images > 1024 bytes
Expand Down Expand Up @@ -673,7 +676,7 @@ The tables below show two different approaches to removing these tiny images fro
<td>79.53</td>
</tr>
</table>
<figcaption>Figure 12. File size by image format for images > 1024 bytes.</figcaption>
<figcaption>{{ figure_link(caption="File size by image format for images > 1024 bytes.") }}</figcaption>
</figure>

The low file size of PNG images compared to JPEG images may seem surprising. JPEG uses [lossy compression](https://en.wikipedia.org/wiki/Lossy_compression). Lossy compression results in data loss, which makes it possible to achieve smaller file sizes. Meanwhile, PNG uses [lossless compression](https://en.wikipedia.org/wiki/Lossless_compression). This does not result in data loss, which this produces higher-quality, but larger images. However, this difference in file sizes is probably a reflection of the popularity of PNGs for iconography due to their transparency support, rather than differences in their encoding and compression.
Expand Down Expand Up @@ -725,7 +728,7 @@ Unlike some of the other tables in this data set, this one has mostly happy take
<td>475</td>
</tr>
</table>
<figcaption>Figure 13. Video size by media format on mobile.</figcaption>
<figcaption>{{ figure_link(caption="Video size by media format on mobile.") }}</figcaption>
</figure>

##### Desktop
Expand Down Expand Up @@ -769,7 +772,7 @@ Unlike some of the other tables in this data set, this one has mostly happy take
<td>756</td>
</tr>
</table>
<figcaption>Figure 14. Video size by media format on desktop.</figcaption>
<figcaption>{{ figure_link(caption="Video size by media format on desktop.") }}</figcaption>
</figure>

## Conclusion
Expand Down
Loading