greggman / twgl.js

A Tiny WebGL helper Library
http://twgljs.org
MIT License
2.61k stars 258 forks source link

API docs are too slow #140

Closed baturinsky closed 4 years ago

baturinsky commented 4 years ago

It takes 22 second to open one article article even locally. Checked both on Chrome and Firefox.

greggman commented 4 years ago

You must have some extension messing things up. The docs are all of 80k compresed. They open in under 1 second.

Screen Shot 2019-10-04 at 13 51 49

Even locally they open fast, 673ms. Just over 1/2 a second

Screen Shot 2019-10-04 at 13 56 22

Maybe you're using python's default simple server to serve them? Python's simplehttpserver has known issues at being slow.

you're welcome to submit a PR though. I can't promise I'll take it but I will take a look

baturinsky commented 4 years ago

Hmm, you are right. But it's network, not extensions. It tries to load https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,500 even if offline, and gives up after 18s

greggman commented 4 years ago

What browser are you using? In Chrome with the network off it loads for me in 139ms. It doesn't wait for the font to download before showing the page.

Screen Shot 2019-10-04 at 15 47 34

Even in Firefox it doens't wait for the fonts to download and only took 230ms

Screen Shot 2019-10-04 at 15 50 01
baturinsky commented 4 years ago

If network is off, browser probably just give up immediately. For me, googleapi just does not respond anything, not even 404, so it keeps trying. That's on latest Chrome and Firefox, but Opera somehow manages to load that font style without issues. Probably problem is with some extensions indeed...

I have temporarily "fixed" it for myself by just blocking that url.

greggman commented 4 years ago

Actually I tested something. If I configure my network to drop connections then I get the 20-40 second issue. No idea if you're running some kind of firewall or have configured your router to block google but if so you probably need to configure your router to reject rather than drop the connections. drop = don't repsond at all so the browser is left waiting wondering when the site is going to respon and finally timing out. reject = respond with 'unavailable' so the browser knows immediately there's nothing there.

Here's one example if you're running Pi-Hole

https://pi-hole.net/2018/02/02/why-some-pages-load-slow-when-using-pi-hole-and-how-to-fix-it/

also

https://serverfault.com/questions/157375/reject-vs-drop-when-using-iptables

baturinsky commented 4 years ago

I have tracked the source of issue, it was wrong ip of google fonts in Windows hosts file. Sorry for false positive.

Btw, I want to thank you for your lib and say that I like your coding style. I though I was only one that prefer vectors as arrays of numbers:)