
Wikipedia's JavaScript Initialisation on a Budget - abbe98
https://phabricator.wikimedia.org/phame/live/7/post/175/wikipedia_s_javascript_initialisation_on_a_budget/
======
evmar
I am surprised to discover that wikipedia appears to not use a standard
minifier on their JS, but rather they have a custom one (written in PHP) that
appears to just do whitespace-style removal, which they appear to run in part
of the critical path of serving (?!) rather than as an offline build step.

[https://www.mediawiki.org/wiki/ResourceLoader/Architecture#R...](https://www.mediawiki.org/wiki/ResourceLoader/Architecture#Resource:_Scripts)

You can 'view source' on a page to confirm that their JS doesn't even do
"safe" transformations like local variable renaming.

~~~
hinkley
Does it really surprise you that people write their own? Or perhaps more
importantly here, that people write their own and then never revisit that
decision as the industry builds up around them?

Sadly all too common in my experience. Disappointing? Absolutely. But few
things of this sort surprise me anymore.

~~~
Ididntdothis
They have something that works for them. Why change?

~~~
hinkley
Because it's a form of vendor lock-in, but for an internal vendor.

Also, is it really working for them? We're responding to someone who thinks it
isn't.

------
pugio
> Wikipedia's startup payload now neatly fits into the target budget of 28 KB
> – chosen as the lowest multiple of 14KB we can fit within subsequent bursts
> of Internet packets to a web browser.

But (according to their linked article) 14KB is only the max size of the
_first_ burst of packets, after which TCP will usually double the size in each
subsequent burst. So two bursts equal 14 + 28 = 42 KB, not 28.

Are they doing this to assume a connection limited to only its initial burst
size? I imagine this might be relevant in low-data areas (developing
countries, etc.), but they don't go in to it.

------
andrethegiant
The "Startup manifest size" graph is misleading. The Y-axis doesn't start at
zero, which makes the Sep 2019 size look like it is multiple times smaller
than the Sep 2018 size. In reality, it's only ~22% smaller.

~~~
xhgdvjky
who cares. look at the numbers. continue with your life... it's not like the
text claims something that isn't true

~~~
erydo
I care a bit. It's misleading by the standards of anyone who's used to reading
graphs. Wikipedia is an organization I care about and trust and it sucks to
skim a graph and realize that the axis was changed to mean something that the
shape didn't convey. The entire value of graphs is using shapes to convey
meaning.

------
scarmig
This is the kind of Javascript work I love. All too often we see terrible,
overly-engineered Javascript monstrosities that actively make the web worse
for everyone, and that can make some of us anti-JS zealots. But JS can improve
users' experiences as well, and the folks at Wikipedia are good at it.

------
bo1024
Tangential, but wikipedia without javascript enabled is a great experience.

~~~
jspash
I have to admit, I couldn't name one javascript "feature" on the site other
than one that incessantly pops up when you mouse-over links. Which I find
_highly_ irritating, but ultimately useful. I have a definite hate/love
relationship with that thing. Maybe it just needs to wait a second before
trying to stop me from reading the existing article.

------
herpderperator
What is "the size of two 14 KB bursts of Internet packets"? MTU is 1500 bytes
before overheard. How did they get 14 KB? What significance does that have?
And what is "burst"?

~~~
herpderperator
Looks like they referenced it later in the article:
[https://tylercipriani.com/blog/2016/09/25/the-14kb-in-the-
tc...](https://tylercipriani.com/blog/2016/09/25/the-14kb-in-the-tcp-initial-
window/)

> So why try to squeeze a website into ~14KB? Seems like you should be trying
> to squeeze it into 1432 bytes.

> I found my answer in IETF RFC 6928 – a proposal to increase the TCP Initial
> Window to 10 segments. The Initial Congestion Window (cwnd) is the maximum
> number of bytes that a server can send without receiving any acknowledgement
> that the bytes were received via a client ACK packet. This maximum number of
> bytes to send is calculated by multiplying some number by MSS. As of RFC
> 6928 some number is equal to 10 (initially).

------
kick
This is a great article. Wikipedia is the only site I have used in a long time
that works better with Javascript turned off.

~~~
swiley
Really? Most sites I go to other than ones like hackernews work way better
without javascript.

If you create an account on wikipedia you can tell them to serve you formulas
using images or mathml but without doing that formulas stop working. Those
hover previews hang midori though, I wouldn't mind losing those.

~~~
ceejayoz
> Those hover previews hang midori though, I wouldn't mind losing those.

On any preview, hit the gear icon in the bottom-right.

------
shanselman
Dat Y-axis.

------
badrequest
Kudos to the Wikipedia/Wikimedia teams for all this hard work!

------
iforgotpassword
Not to abuse this post's comment section but I recently noticed that on IE11
mobile, image captions overlap with the article's text. I don't think this is
relevant enough to formally file a bug report (browser seems to be grade c)
but in case someone working on the site's CSS reads this and feels overly
bored, well..... ;-)

~~~
zcrackerz
It may never be prioritized, but it's much better to have a bug report/ticket
than to casually mention this in a comment no one will ever see.

