r/javascript • • May 02 '17

YouTube's new UI uses Polymer

https://youtube.googleblog.com/2017/05/a-sneak-peek-at-youtubes-new-look-and.html
212 Upvotes

98 comments sorted by

View all comments

47

u/mort96 May 02 '17

Just tried it out. Significantly slower in Firefox. From I mouse over the sidebar to the javascript notices and I can actually start scrolling, it takes around a second for me. Same with going back to the main section.

29

u/SkaterDad May 02 '17

Firefox really needs to get its JS perf up to par. I love using it for ideological reasons, but have to switch to Edge or Chrome sometimes to make poorly made sites usable (looking at you target.com...). Inbox & Keep are a bit laggy on Firefox also.

It's also incredible to me that Google still releases sites that work slowly in some browsers, given their vast engineering knowledge and evangelists like Addy Osmani, Paul Lewis, etc... who are always promoting best practices for perf. Do they test?

31

u/ergo14 May 02 '17

Actually - Firefox is getting 3x HTML size than Chrome - maybe its a bug. Assets like svg icons - etc. everything gets piped down directly in main document.

3

u/rq60 May 03 '17

It's probably because chrome supports HTML Imports while Firefox does not.

16

u/ergo14 May 03 '17

I developed Polymer applications. This has nothing to do with html imports.

10

u/rq60 May 03 '17

Well the only part of web components that firefox supports fully withouts bugs or without a flag is templates, so everything else has to be polyfilled. I'm not saying it's that, but it seems highly likely.

6

u/ergo14 May 03 '17 edited May 03 '17

Like I said, this has nothing to do with that. Watch literally any component example like polymer shop demo if you don't believe my word (https://shop.polymer-project.org/ or https://news.polymer-project.org/list/top_stories). It doesn't have any of that crap in Firefox. It's something specific just to yt app. The polyfills are small, here we are seeing yt resources embedded incorrectly in source html. Normally the code you write is the same for all browsers, regardless of their capabilities. Webcomponents-lite.js handles the rest for you. And it's 20kb total, here we see additional 100kb HTML out of nowhere based on user agent.

→ More replies (2)

0

u/[deleted] May 03 '17

[deleted] — view deleted comment

4

u/Mark_at_work May 03 '17

Polymer is from Google too.

→ More replies (1)

0

u/[deleted] May 02 '17

[deleted] — view deleted comment

10

u/[deleted] May 03 '17

No, Firefox has been a bit delinquent in implementing web components, so it requires a polyfill to run polymer. I don't really think it makes sense to use the new UI if you are running Firefox, Edge, or IE.

Mozilla has web components (other then imports) under developments so it should be rectified soon.

10

u/ergo14 May 03 '17 edited May 03 '17

Aht the mythical polyfills making internet slow, as I pointed out in other comments here - the problem lies somewhere else - it seems to be YT code related.

2

u/dbbk May 03 '17

Are you suggesting that polyfills aren't slower than native implementations?

→ More replies (2)
→ More replies (1)

2

u/vinnl May 03 '17

delinquent

It's only been recently standardised, and no browser other than the one pushing for this standard (i.e. Chrome, whose team also delivers Polymer) had already implemented it. Firefox did implement it behind a flag, but since the standard's changed it still has to be updated.

So it's not "delinquent" (just like Safari and Edge aren't), implementation just takes time. And that's something you'll have to live with when you use Polymer (and I'm sure the YT team consciously made that trade-off).

2

u/[deleted] May 03 '17

Safari mobile supports it (so I assume that desktop Safari does too) and usually Firefox is ahead of Safari on these things.

→ More replies (1)

11

u/vinnl May 03 '17

It's pretty unfair to blame this on Firefox. Polymer was built around in-development web standards that Chrome already implemented while they were still being defined. To support other browsers, Polymer uses polyfills which cause noticeable slowdown on all browsers that aren't based on Blink.

Version 1 of the standard has just been finalised, and is now being implemented by all browsers. (Note that the polyfills also do not yet support this version in a stable release.) Until then, Polymer applications are going to need a lot of optimizations to be on par with other web applications, performance-wise.

6

u/ergo14 May 03 '17 edited May 03 '17

Vinnl - not really - check https://news.polymer-project.org/list/top_stories or https://shop.polymer-project.org/ under firefox this works great. This has nothing to do with polyfills - I checked the source and it seems YT backend does some agent sniffing and it serves three times more html markup to firefox than to chrome. Indeed this is not firefox that should be blamed, but also not polymer or polyfills - this is something stricly related to YT application. The code also seems machine generated, like GWT/gmail stuff.

→ More replies (1)

3

u/YooneekYoosahNeahm May 03 '17

Polyfills? I know it's pretty unlikely. Might just be gecko/spidermonkey?

→ More replies (12)

4

u/ergo14 May 02 '17

Hm, what browser do you use? I'm using Firefox under linux normally so it uses polyfills and works great for me. I assume chrome/safari would be better because they don't need any polyfills.

0

u/[deleted] May 02 '17

[deleted] — view deleted comment

5

u/mort96 May 02 '17

I wouldn't know, I'm not even able to use it as it has a hard dependency on chrome. Not a fan of Google making Chrome required to use their services, leaving other browsers with either poor performance or no support at all.

5

u/EstT May 03 '17

Mmmm, a company slowly making their sites work better in their browser... I'm sure I've seen this before...

4

u/bogas04 May 03 '17

Polymer uses several polyfills to run on Firefox, hence it's much slower there.

2

u/mikejoro May 03 '17

Polyfills doesn't mean they are slow. In fact, native promises in Javascript are actually slower than bluebird promise library by a lot.

→ More replies (4)
→ More replies (8)
→ More replies (1)