GithubHelp home page GithubHelp logo

Comments (31)

richardtape avatar richardtape commented on June 2, 2024

I'm all for absolutely everything in your branch in the head tag. Like the comments, too. Considering when I read the title, I immediately went to html5 boilerplate, I think that sums that up.

I'm not sure if this is a relevant comment to this issue due to the parentheses in the title but I'd really, really, like to not have jQuery in our basic page by default. Maybe we can link to the docs about how to include it properly should people wish.

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Wholeheartedly agree about jQuery. It was placed there as an example of how to load an external javascript library (with subresource integrity and fallback) rather than an endorsement of jQuery specifically.

from ubc-def.

richardtape avatar richardtape commented on June 2, 2024

For sure, and it's an excellent example. I think I'd just prefer it if either it was commented out by default, or we simply linked to a post on how - generically - to include external JS (with SI and Fallback).

Ultimately I don't want people picking this up and "accidentally" getting jQuery on every page load without realizing it. If I'm being totally honest I'm not completely averse to making it a little trickier for people to get jQuery in here in the first place.

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

I agree that jQuery should be remove or disable by default, so that developers will only enable it if they need to.

For Google Font, since it won't load for traffic coming from China, should we provide some information on this? I wonder if Google Font should be enable/available by default.

from ubc-def.

occupant avatar occupant commented on June 2, 2024

That's a good point about the Google Fonts. We could look at changing the swap value to optional. You can find details on the font-display property here and here. IE 11 doesn't support it of course, but it gets us 90% of the way for now.

Basically, from what I understand, font-display: swap; allows FOUT - it shows text and continues to load the font, then updates the text when it's ready (if ever).

font-display: optional; waits 100ms and then renders text regardless of whether the font has loaded or not. Need to confirm that it kills the request successfully, but otherwise I think this is the option that would be best suited.

The other values are font-display: fallback; and font-display: block; but those strike me as not what we want.

In terms of support for font-display, IE is an issue (caniuse).

All of that presupposes that we use it at all :/

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

Feedback based on latest discussions with contributors

  • Test preload with swap optional and see how it impacts in China.
  • remove jquery and use sample.js as placeholder

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Google Font Testing from China with display=optional

from ubc-def.

richardtape avatar richardtape commented on June 2, 2024

a) I love the look of the page
b) Am I reading this right? 38 seconds?

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Yes. The reload is super quick, so it's really a connectivity issue. Everything is slow to get there, executes really fast. Uncached time to page interactive is 15s. Gross.

That said, there's a few injected scripts I have no clue about and it's Firefox on 3G. Do you know of any other ways to test in China? I'm not sure this is ideal.

EDIT: I really just want to see how the display=optional functions

from ubc-def.

richardtape avatar richardtape commented on June 2, 2024

The only other thing I've seen mentioned is http://www.webkaka.com/ which, err, isn't the easiest to use or understand when you speak precisely zero words of any Chinese language.

But I threw the URL into the box next to the button marked 'Check' (handy random English word!) and the table that came up on the following page seemed...better?

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

The only other thing I've seen mentioned is http://www.webkaka.com/ which, err, isn't the easiest to use or understand when you speak precisely zero words of any Chinese language.

But I threw the URL into the box next to the button marked 'Check' (handy random English word!) and the table that came up on the following page seemed...better?

I just test it, but it doesn't seem to provide much detail like webpagetest.

Another one is easier to understand, but also not enough detail provided.
https://www.chinafy.com/tools/global-speed-test

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Chinafy results for the same page are way faster (included screencap) but, yeah, not much in the way of details.
Screen Shot 2019-11-13 at 2 21 34 PM

Edit: I'd be so happy if I could trust those results :)

from ubc-def.

richardtape avatar richardtape commented on June 2, 2024

I think my point was it clearly shows it doesn't take 38 seconds to load, so there's something not quite right with the WPT results.

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

Yes. The reload is super quick, so it's really a connectivity issue. Everything is slow to get there, executes really fast. Uncached time to page interactive is 15s. Gross.

That said, there's a few injected scripts I have no clue about and it's Firefox on 3G. Do you know of any other ways to test in China? I'm not sure this is ideal.

EDIT: I really just want to see how the display=optional functions

Both Chinafy and webkaka showed pretty responsive page load and first patime, but without much detail provided.

Screen Shot 2019-11-13 at 2 22 25 PM

from ubc-def.

richardtape avatar richardtape commented on June 2, 2024

In this case, is it not in our best interest to get some manual verification of this? Can we get someone to take a look and allow us to compare to the Chinafy results? If the manual tests match up with the Chinafy results then we can use Chinafy moving forward as a true indication as to what is happening. Or am I missing something?

from ubc-def.

occupant avatar occupant commented on June 2, 2024

That would be ideal. WPT seems like a very poor tool for testing this specific scenario.

Do we know anyone in a major Chinese center that can run a test and send us the results? Our current Web Services coop is headed back to China in a month, but maybe he has some friends. I'll ask.

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

@occupant , could you also test a page without display=optional and run it again on Chinafy and webkaka?

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

I just test UBC.ca on Chinafy, and it does have a much longer load time on China based servers. Once it's identify as "slow", it does provide more detail, waterfall chart, on which request is slow.

from ubc-def.

occupant avatar occupant commented on June 2, 2024

@hazuremon So display=swap (google's recommended implementation) or omitted altogether?

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

Maybe just swap to see if there is any major difference? Kind of assume omitting it will slow down quite a bit?

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Turns out the waterfall on Chinafy is always there. It's just hidden until you mouse over the row - UX alert! heh

http://ws-bronze.webi.it.ubc.ca/sandbox/def/beta/page-swap.html
Screen Shot 2019-11-13 at 3 18 47 PM

http://ws-bronze.webi.it.ubc.ca/sandbox/def/beta/page-no-fonts.html (google font requests all removed)
Screen Shot 2019-11-13 at 3 16 50 PM

http://ws-bronze.webi.it.ubc.ca/sandbox/def/beta/pages.html (display=optional)
Screen Shot 2019-11-13 at 3 17 47 PM

from ubc-def.

richardtape avatar richardtape commented on June 2, 2024

I'm starting to get optimistic about this. What a strange sensation.

from ubc-def.

occupant avatar occupant commented on June 2, 2024

I didn't run it on webkaka because I really can't make heads or tails of it. Could be I was hypnotized by the page design.

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

So basically performance wise, swap or optional have minimal performance difference? For swap, can we tell how long before the font is swapped in the test? Wonder if Google font takes 20s to load, will the swap happen 20s later?

from ubc-def.

occupant avatar occupant commented on June 2, 2024

That's what it looks like to me. You can see we go from 9 resources to 5 with almost no discernable difference.

swap makes sure you're not render-blocking and will create a flash of unstyled text (assuming your font comes late to the party).

optional tries to prevent flash of unstyled text by giving it up to 100ms to load, then moving on with whatever is loaded at that point and not ever swapping afterward.

To me, optional sounds better, but I don't feel strongly either way.

Also, spoke to our coop and he has some friends who may be able to run a real-world test within China if we make it easy enough for them to do so :)

from ubc-def.

occupant avatar occupant commented on June 2, 2024

@hazuremon re: swap time. No, we can't see in the waterfall where it actually does the swap - we'd probably have to review a render movie capture (like on wpt). And you're right about swap - that's how it's designed to work. The swap takes place when the font is ready, which could be anytime. So it it takes a minute to download, it will swap at that point.

This delayed load is common on slow connections (mobile esp) and looks really bad, especially if there's a big shift due to line length, height, etc. All of a sudden the page shifts when you're reading it. On a phone, that can mean you even have to reorient to find the place you were. That's basically the reason I prefer optional. The text is hidden for 100ms, then whatever font is available is shown.

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Have tested and confirmed that &display=optional argument doesn't stop / end the request, it simply ignores result of the request if received following the allowed 100ms period.

  • Recommendation (James) - With the confirmation above, it seems as though the only advantage to using &display=optional is to prevent the reflow of text when a font only becomes available late in the response. Detailed description of the properties : https://font-display.glitch.me. Recommend using &display=optional or &display=fallback (which has a 3s permissible font swap period) over &display=swap to prevent late render font rerendering.
  • Recommendation (James) - for sites with a lot of international traffic (including China), recommend using local versions of the fonts in place of the Google hosted fonts. This gets past two issues. 1. The font resources will not be blocked by firewalls. 2. We will eliminate at least two http requests, meaning it should load as fast or faster. Local Fonts should be an configurable option in the CMS Templates (Wordpress / Drupal).

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Running a few tests on chinafy.com and noticing the site.webmanifest file is just being a boatanchor. No idea why, it's just json, ~500bytes, yet over a second in many cases to resolve.

To reproduce - https://www.chinafy.com/tools/global-speed-test?site=http://ws-bronze.webi.it.ubc.ca/sandbox/def/beta/page.html&network=Good3G

To be clear, this is in ALL results, regardless of region. Found this as well, so not sure if it's lighthouse specific (they could be using Lightouse to produce results on chinafy.com) or a real issue. GoogleChrome/lighthouse#9505.

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Ok, just ran a test with manifest vs no manifest on Chinafy. The results are startling

Screen Shot 2019-12-11 at 2 26 40 PM

Screen Shot 2019-12-11 at 2 26 24 PM

Until we can get confirmation that the site.webmanifest isn't killing performance, I'd say it's best to exclude it.

from ubc-def.

occupant avatar occupant commented on June 2, 2024

Visual representation of display value differences (source):
be746fa6-6ce9-423d-b9a3-684949adc8d5-Screen Shot 2017-11-14 at 2 49 37 PM

from ubc-def.

hazuremon avatar hazuremon commented on June 2, 2024

Team has reviewed and discussed the following:

  1. Web font display approach between Fallback and Optional
  2. Drop of jQuery in the default setup
  3. Index.html boilerplate

For web font, long discussion towards the pros and cons of display=optional over display=fallback. Decision is to pre-set to display=optional due to:

  • People hate FOUT (Flash of Unwanted Text)
  • Impact - potentially affected a small group of people and only their first visit with alternative page views and refresh will see the web font
  • Not seeing web font is not the decision of the site visitors, while performance impact does

jQuery already decided earlier and will be drop
#41 (comment)

index.html - to start from html5boilerplate but to be customize for our use. Separate issue to follow on index.html based on decisions made.

from ubc-def.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.