-
Notifications
You must be signed in to change notification settings - Fork 518
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
Show code examples faster #283
Comments
I am guessing here the browser makes some optimisations, focusing on content from the origin domain first, and then loading content from external sources. As the plaint text examples are contained within the iframe of the editor, it is loaded later along with the editor code. |
Thanks Schalk! Here are a few things that jump out at me, but I'm no performance expert and have no idea how feasible any of this is:
|
@atopal Here is something we can try, although it would need to be added on the Kuma side to all page types(I guess article) that can contain an interactive example. Because we connect to the CDN, and the CDN is also If we add the following to the head of those pages
We may be able to negate it some. Something to keep in mind with this, is that these are hints, and could be completely ignored by the user agent.
That does not fit our purpose as the resource is loaded on the same page. Thoughts @wbamberg @stephaniehobson FontsThe benefit we gain over the cost to load the web font is so low, that here I would vote to simply use the system sans-serif and safe some bytes, and one less request. |
@atopal Also, are you seeing any entries on GA for:
|
We could also potentially inline any critical CSS to improve load time some. Not sure how much benefit we will get in this particular case, as there is not a lot of CSS in general. Worth a shot though. |
Well, the nice thing is that we can try any sort of optimization and simply look at the results to see whether it has an impact or not :) |
I'm seeing stuff in GA for the analytics :) I think the pre-fetch/preconnect is a good idea. The iframe is definitely a low priority for the browser and that seems likely to speed up getting it. I have another much more complicated idea* if we're not happy after that. Font loading is not render blocking and shouldn't be slowing the iframe down. I wouldn't spend time on that before trying the other things (But I thought we had decided not to use webfonts?) * we could pre-fetch the non javascript version with kumascript and display that while we ajax load the iframe in, and swap the pre-loaded HTML with the iframe once all the assets have arrived. |
Indeed we are not :) There are some of the specific CSS examples that do load FiraSans but, they are not part of the currently tested examples. I assume the font loading the Kadir saw must have been MDN itself.
Which version are you referring to here? Is this something that already exist or, are yo thinking of a change to the editor?
Yes, I agree that this is well worth implementing to see the effect it has. @atopal Is there a way I can get access to the Analytics for MDN? |
Hey Schalk, I can give you the data if you have any specific requests. To get access to the MDN account on GA, you need to file a service now ticket. And yeah, I was referring to web fonts loaded for the article page. If you go to the waterfall images on the pages I linked to in the first post, you can see that fonts are loaded before the assets of the iframe are loaded. Not sure if it's blocking, but it seems consistent. |
@atopal At this time, I am mostly interested in this metric: |
I was thinking of what loads when the user has JS disabled. That already exists :) |
Oh yeah, this is still in the |
Pull request: mdn/kuma#4455 |
Would it be possible to use a Kumascript macro to pull in that content at render time? |
Kumascript has the ability to scrape a page. I'm suggesting it pull in the non-js version from the CDN and display that while the iframe loads. |
I have no idea how this works but, it sounds super promising. With that said, I am curious now, how would that work? |
My worry about this would be a "flash of unstyled content" effect. Another even more radical option would be: don't use an iframe, but build support for the editor into Kuma's front-end. The only reason the prototypes used an iframe was that it's much easier to experiment like that. It's not obvious to me why the production version should use an iframe (the old live samples use one for security, because they are Wiki-editable). But this is a much bigger change :(. |
We should talk about how hard this would be in the sync up tomorrow. |
PR: #309 |
I reckon we have reached an acceptable level with the editors. While there is always room for improvement, I feel like we can close this one for now.
|
The film strip and waterfall views here show how the interactive editor for JS and CSS example content is loaded pretty much as the last thing. On the cable connection from Dulles, that's a 1 second delta between seeing examples on pages with and without the editors.
The main issue to be addressed here is that code examples should be shown faster, which may or may not be the same as improving load times for the editors.
The text was updated successfully, but these errors were encountered: