WordPress / wordpress-playground

Run WordPress in the browser via WebAssembly PHP
https://w.org/playground/
GNU General Public License v2.0
1.61k stars 240 forks source link

Enable networking by default #1225

Open bgrgicak opened 5 months ago

bgrgicak commented 5 months ago

Having networking disabled by default is a performance improvement, but working networking is something most of us expect out of the box. I suggest that we enable networking by default and allow disabling it to improve user experience.

@adamziel @brandonpayton what do you think?

adamziel commented 5 months ago

I'd be more than happy to do that if it didn't add 5-10 seconds to loading /wp-admin and random screens. It makes the difference between "oh it's so fast" and "oh it's so slow" at the expense of an occasional "oh something isn't loading". Perhaps we could tactically block or pre-fetch specific api.wp.org requests though to make it faster.

bgrgicak commented 5 months ago

Perhaps we could tactically block or pre-fetch specific api.wp.org requests though to make it faster.

We will eventually need to preload "everything" if we want offline support (#1086). When we have that, it might be a good time to reconsider enabling networking by default.

brandonpayton commented 5 months ago

@adamziel @bgrgicak, what does the performance cost of enabling networking come from?

adamziel commented 5 months ago

@brandonpayton /wp-admin won't render until all the network calls are finished, and requesting api.wp.org using fetch() is not as fast as native network implementation running on a server with a fast network connection.

brandonpayton commented 5 months ago

@adamziel thanks, that helps! As a random thought, are there any api.wp.org requests that we could reasonably intercept and provide stub data for?

adamziel commented 5 months ago

I think we could pre-fetch or stub most of them! I'd only run "synchronously" the ones where it actually fetches a filtered list of patterns, plugins, themes.

flexseth commented 4 months ago

I think we could pre-fetch or stub most of them! I'd only run "synchronously" the ones where it actually fetches a filtered list of patterns, plugins, themes.

Speculative Loading - could be helpful to offset speed loss https://make.wordpress.org/core/2024/04/09/speculative-loading-in-wordpress/