

Ask HN: Should I use Polymer for my next project? - illuminek

I have been planning to use polymer for next project for frontend and rails on server. I have read the article posted here https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7970781 I am still noticing that polymer is slow on FF,Safari etc(almost freezes for 2 secs). However works great on chrome.<p>Project would be mobile first web app(or may be mobile only). I am also considering Phonegap along with polymer. Is it a good idea to use phonegap? Is it going slow down even further?<p>Google I&#x2F;O talks highly about but I don&#x27;t see much improvement in performance and also I am doubtful if the eco system is mature enough to consider it to ship a product in next 2 months or so?
======
smarks159
The reason polymer is slow on firefox and not on chrome is because firefox
does not support html imports yet, so polymer uses a polyfill that relies on
asynchronously loading the html which causes a delay in the initial load.
Support for html imports is not implemented in safari either.[1]

[1] [http://caniuse.com/#feat=imports](http://caniuse.com/#feat=imports)

~~~
spankalee
The HTML imports polyfill shouldn't be much slower than native, since native
imports are also asynchronous, but block execution of subsequent scripts. Any
(small) slowdown would be from the browsers pre-scanner not knowing to
optimistically load imports. This can be avoided completely by using the
`vulcanize` tool which bundles all imports into one file.

------
spankalee
First, are you using Polymer 1.0? It's much lighter weight than Polymer 0.5.

Second, is this a big project with lots of transitively dependencies? Like ES6
modules, HTML imports encourages more granular files that can be referenced
and loaded individually. With HTTP/1 this can cause slowdowns as you hit the
browser's request limit. HTTP/2 loads a bunch of small files significantly
faster. For production we recommend the `vulcanize` tool which concatenates
all HTML imports into one file for fast loading.

If you are using 1.0, do you have an example that shows the 2 second freeze?
That shouldn't be happening.

------
richerlariviere
You should Forget about using polymer with Firefox. Html imports won't be
supported. [https://developer.mozilla.org/en-
US/docs/Web/Web_Components/...](https://developer.mozilla.org/en-
US/docs/Web/Web_Components/HTML_Imports)

------
cyrusaf
I used Polymer for a project a few months ago and I ran into browser support
issues. Polyfills helped for most browsers, but my application wasn't working
on iOS Safari. I'm not sure if that is still the case, but if so, I would
choose to use a different framework such as Angular (easy to pick up) or React
(slightly more difficult to pick up).

~~~
filipstachura
During Polymer was in beta I had same problems (safari). Would be good to
check if that is solved with 1.0.

------
xiaoma
No.

~~~
jklein11
Can you elaborate?

------
catpolice
I'm optimistic about web components, but I don't think Polymer's ready yet - I
was seeing their demo components not work in a new Chrome on Linux just a
couple months ago (they still may not work, I'm too lazy to go through the
examples right now).

The main two draws of Polymer are that it's built on web components (which are
cool and futuristic) and that it implements material design (which is nice
looking). There are other material design widget libraries however, even ones
made by Google. Have you seen MDL
([http://www.getmdl.io/](http://www.getmdl.io/))? It's a more minimalistic
CSS/Javascript approach and will probably be faster and more cross compatible.

FWIW the three things you mentioned (Polymer, Angular, React) are kind of
dissimilar in an apple-to-oranges way:

* Polymer is basically a UI widget library with some other bits thrown in - it doesn't really help you structure your application, it's just widgets for building the view layer.

* Angular is a full-ish MVC platform that provides you with tools to build your own UI components/widgets

* React is just a toolkit for building UI components, and it doesn't come with anything else (but it does encourage a kind of design where you don't need much else)

Neither of the latter two come with pre-built widgets: you have to make them
yourself or find libraries of them made by others (which is pretty easy to
do).

For my money, your expectation on which of these is easy to pick up is
backwards: Angular is way, way more complex than React and has a much higher
learning curve. React does basically one thing (and does it very well) so
there's really not much to learn about it at all - you can pick it up in a day
once you wrap your head around the rendering-as-a-pure-function-of-state
concept. Angular is a full framework and it does a lot of things and is
opinionated about how it does them, so there's a whole lot more to learn. If
you need all that MVC stuff done for you, Angular might be the way to go
though (but beware the coming 2.0 transition that's going to break all
backwards compatibility completely).

I personally like React a lot - I'm probably going to try to wrap MDL
components in React for a project I'm working on right now.

~~~
illuminek
Thanks for sharing the link [http://www.getmdl.io/](http://www.getmdl.io/) I
did not know about it.

I think you are right, Team is thinking in similar lines. Thanks.

