XF 2.3 Boosting performance in XenForo 2.3

googlechrome.github.io_lighthouse_viewer_ (4).png
In today's 'Have you seen...?' entry for XenForo 2.3 we're going to look at how we've zeroed in on enhancing performance, ensuring your community has a swift and seamless experience. We're going to take a deep dive into the advancements we've made and how they stack up against various performance metrics.

But, before we get into the individual changes, let's take a quick look at the baseline - this is our current Performance score as calculated by Lighthouse for the XenForo Community forum list:

googlechrome.github.io_lighthouse_viewer_.png

Here's the performance scores for some other forum software:

1.png
2.png
3.png

It's crucial to note that while this score provides a performance benchmark, it isn't the only indicator of success. Indeed, results can fluctuate slightly with multiple test runs. A site can still enjoy popularity with a lower score, but a higher rating undeniably enhances both search engine rankings and overall user experience.

Stay tuned! We'll reveal XenForo 2.3's updated score shortly. But before that, let's dive into the changes that have brought us here, shall we?

If you would like to jump to a particular section, use the links below.
Alternatively, if you want to skip a whole lot of reading, check out the TL;DR below:

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Oh and if you're concerned that all we've got to show you in XenForo 2.3 is performance improvements - fear not.

We will be showcasing a brand new feature next week!
 
I love this. Upgraded to 2.3 today, update the custom theme from DohTheme and the required add ons that our fantastic 3rd party developers have already updated. And then ran a little test:

1720880468421.webp


This really blows my mind.
 
Desktop results comes from test with good connexion like fiber or adsl, mobile results comes from test with bad connexion like 3G. Ads system are likely bad for mobile results.
 
I haven't seen a Google Pagespeed mobile performance above the low 70's when the page has ads on it, and that is with Google's own ad networks. Desktop performance can reach as high as 100 when a page has ads on it.
I have adsense, analytics and no cloudflare.

Just tested with PageSpeed Insights on a thread, first run was not as good as second run: 75, 92, 96, 92
Tested on the homepage also, got: 77, 92, 96, 92

I havn't upgraded to 2.3 yet, the better speed with 2.3 is probably what I've been looking forward to most about 2.3
 
Still no video handling /use of ffmpeg in standard thread posts? 600GB of video and half a million users later here. Lame. You've had years to figure it out.
 

Font Awesome improvements​

On almost every page we serve currently, we include as many as five different variants of the Font Awesome 5 Pro icon library. That's up to 8,000 icons split across their different variations, but on any given page we actually use... a lot less than that. The file size of each of these fonts is up to 200KB with an additional 40KB worth of CSS.

We have always wanted to ship a much smaller subset of icons but when admins, style designers and add-on developers have the full suite of icons available to them, this can be a challenge. In particular, working with fonts directly in order to create a subset can prove to be somewhat tricky.

Back in 2019, we prototyped something very similar to the excellent Font Awesome Manager add-on released by @Kirby, but we ultimately decided that this wasn't necessarily the approach we wanted to take.

In XenForo 2.3 we have developed a brand new way of subsetting Font Awesome icons so that only the icons which are actually used across your XenForo installation are ever served to your users and, even better, it's entirely automatic!

Icon usage analyzer​

XF 2.3 now includes an icon usage analyzer which can analyze precisely which icons are being used across various content types, including within Less templates, and HTML templates, template modifications, phrases and even within JavaScript.

The way that you use icons is not significantly changing from what it was in XF 2.2. For example, if you're familiar with using, e.g. <xf:fa icon="fa-comments" /> in templates or .m-faContent(@fa-var-comments) in Less templates then you're all set.

However, some approaches will no longer work. For example, using <i class="fas fa-comments"></i> will no longer work. These usages will not be analyzed and will not result in an icon being displayed. Because of this, there is a brand new syntax for use in phrases.

See the table below for examples:

TypeCode
Templates / template modifications
HTML:
<xf:fa icon="fas fa-comments" />
Less templates
Less:
.m-faIcon(@fa-var-solid-comments);
JavaScript
JavaScript:
XF.Icon.getIcon('solid', 'fa-comments')
Phrases
Code:
{icon:fas::comments}

We are aiming to go into a little more detail surrounding the icon usage analyzer in an upcoming developer-focused 'Have you seen...?' but for now it is important to note that the usage analyzer can of course be extended in order to support analyzing in custom content types and other scenarios, including special casing specific icons.

Rendering icons​

So, what do we do with the analyzed icons? Well, rather than working with a somewhat clunky font file format, we use the information to produce an SVG sprite sheet. Actually, not just one, but one for each of the Font Awesome 5 Pro styles - light, solid, regular, and duotone and each of those contains only the icons we analyze in those styles.

For example, here's the full extent of the spritesheet we generate for the solid style, by default:

XML:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Font Awesome Pro by @fontawesome - https://fontawesome.com
License - https://fontawesome.com/license (Commercial License)
-->
<svg xmlns="http://www.w3.org/2000/svg">

    <symbol id="check-circle" viewBox="0 0 512 512">
        <path d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"/>
    </symbol>
    <symbol id="exclamation-circle" viewBox="0 0 512 512">
        <path d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"/>
    </symbol>
</svg>
This is only loaded on the pages that actually use those icons but, what is even better, is that whereas previously we'd load a full 137 KB font file, this spritesheet weighs in at a mere 726 bytes.

Overall, the total file size we were loading for icons by default on the forum home page was around 400 KB now it will be less than 40 KB.
Do we need to do something after update or this is enabled by default?
 
Back
Top Bottom