Hacker News Readers as Progressive Web Apps
hnpwa.com
hnpwa.com
Fundamentally, every implementation is different at a UI level. They all have different designs, some have custom fonts. Some go directly to the Firebase source, whilst others go via an intermediate API. The scores that are being listed are affected by too many variables beyond the UI library for them to mean anything at all.
In addition, a spiritual successor to TodoMVC is going to have to reflect actual upcoming patterns in user interfaces. Things like shared element transitions, sound effects, perhaps some 3D effects, and numerous other things. Most HN clones don't even allow write operations, even TodoMVC has that.
For example, the React example has an "F" grade for static caching, whereas some other examples have "A". Doesn't sound like something a JavaScript library can influence.
Why is it that way? Because these are just sample projects from different people created at different points in time, served on different hosts, but suddenly brought under a single umbrella as if it was an organized project from the beginning.
There are big differences in build systems, e.g. some examples are optimized by hand to inline critical CSS at the build level, others aren't. There's nothing that prevents applying the same strategies to all examples, but the fact is some example authors had time to do it, and others didn't. Wouldn't it make sense to at least use the same build system for Preact and React examples?
I appreciate the effort by Addy and other folks from Google to highlight performance issues in web apps, but as it stands right now I consider the website to be rather misleading.
Firebase API has gotten slower over the years. That affects Interactive time and lighthouse score. Preact HN uses their own servers, and React HN uses the Firebase API.
Also, some passes site is progressively enhanced check because some elements are rendered without JS. Which results in higher score.
Preact HN loads offline but without content. Lighthouse assumes that app works offline, but in reality app is useless without actual stories.
I use Firebase API in my web app (https://hn.premii.com/) and scrap YC in my downloadable app (https://hn.premii.com/about/). Both has different actual and perceived performance.
Write operations are not possible with HN clones as there are no YC apis. They should build reddit clone. I have build reddit clone https://reddit.premii.com/ using their official APIs.
1. Go to main page. 2. Enter a long comments section. 3. Scroll down. 4. Hit back (back to main page again). 5. Hit forward (back to comments section).
Expected: Scroll position is restored.
Actual: Scroll position is not restored (most of them), back is broken (Svelte), scroll is some random place (Polymer).
Edit: Just tried again using Chrome, back + forward consistently took me to the same scroll location.
Edit 2: Ahh, Chrome doesn't restore scroll position correctly if you scroll a bit when you go back to the home page before hitting forward. Safari handles this fine.
Overall they're pretty quick on my Galaxy S2. A bigger concern is formatting - some adjust for mobile, others do not and the font is displayed in .5 millimetre type. :(
(perhaps I should apply for a testing job!)
In these last 4-5 months that I have been a frontend dev (angular) and have played around with chrome throttling dev tool and questions by product about load time that I realised how life is difficult for web developers and users in emerging markets.
It's not like one doesn't have to think of load time, performance, and bandwidth in Android but, there, things are quite standard to some extend when comes to achieving a decent level of performance.
One thing I have learned, and still learning, and that is avoid jquery (and esp. it's plugins) as much as you can. I mean they can pile up really fast.
Another thing is that each of these implementations pre-cache most (if not all) of their static resources with a service worker -> and that's why repeat visits on each site is quite fast. Using incognito or clearing the site data and unregistering the service worker and then loading the site as a first-time visit under those throttled conditions will let you easily notice how much faster some of the implementations are then others (for example: Preact and Angular)
Agree with performance on first time loading. Famous ones: Angular, React, Vue felt slow.
Requirements: lex, cc
Usage:
fetch -4o yc.htm https://news.ycombinator.com
yc < yc.htm
To compile this I use something like flex -Crfa -8 -i yc.l;
cc -Wall -pipe lex.yy.c -static -o yc;
Save the text below as yc.l then compile as above. #define jmp BEGIN
#define p printf
#define x yytext
%s aa bb cc dd ee ff gg hh
%s ii jj kk ll mm nn oo
aa "span class=\"rank\""
bb "a href=\""
cc score_........
dd \>
/* #include <time.h> */
/* #include <util.h> */
%%
[^\12\40-\176]
, p("%2c");
/* rank (dont care) */
{aa} jmp aa;
/* <aa>[1-9][^<\.]* p("\n%s,",x);jmp bb; */
<aa>[1-9][^<\.]* p("\n");jmp bb;
/* url */
<bb>{bb} jmp cc;
<cc>http[^"]* p("%s,",x);jmp dd;
/* title */
<dd>{dd} jmp ee;
/* <ee>[^><]* p("%s,",x);jmp ff; */
<ee>[^><]* p("%s",x);jmp ff;
/* host (omit) */
/* points (dont care) */
<ff>{cc} jmp gg;
<gg>{dd} jmp hh;
/* <hh>[1-9][^<> p]* p("%s,",x);jmp ii; */
<hh>[1-9][^<> p]* p(",");jmp ii;
/* user */
<ii>{bb} jmp jj;
<jj>http[^"]* p("%s,",x);jmp kk;
/* time (dont care) */
<kk>{bb} jmp ll;
/* <ll>http[^"]* ; */
<ll>http[^"]* jmp mm;
/* unix time (dont care) */
/* <ll>[1-9][^<]* {
time_t t0; time_t t1; time_t t2;
t1=time(&t0);
t2=parsedate(x,&t1,0);
p("%d,",t2);
jmp mm;
} */
/* item */
<mm>{bb} jmp nn;
/* <nn>http[^"]* p("%s,",x);jmp oo; */
<nn>http[^"]* p("%s",x);jmp oo;
/* comments (dont care) */
<oo>{dd} jmp oo;
/* <oo>[1-9d][^ <]* p("%s",x);jmp 0; */
<oo>[1-9d][^ <]* jmp 0;
.
\n
%%
main(){ yylex();}
yywrap(){ p("\n");}I haven't read through each repo's source yet, so take what I'm saying with a grain of salt. Glancing through each repo, only the Angular 2 version has tests. It's pretty easy to write throw away code that works once and you don't have to maintain long-term, so I'd advise caution in adopting patterns from these examples.
It's has login, vote and save(I guess it saves articles locally)
The con is that it has not been updated in a long time.
It's available on fdroid
I wonder how fast a standard server side, non-JS version compares.
I do have 802.11ac on 100mb fiber...
[1] https://github.com/tastejs/hacker-news-pwas/issues/7#issueco... [2] https://github.com/tastejs/hacker-news-pwas/issues/4
Getting up and running with Preact, TypeScript (or Bublé[0]) and Rollup is pretty simple, and gives an extremely small and very fast bundle, which I just adore.
The big thing, is that by choosing the right tools, I can keep my `ls node_moduels | wc -l` small, and Rollup's tree-shaking takes that even further. With some forethought, one can achieve this with React, too, but I find Preact beautiful to use, and Hyperscript instead of JSX can be a boon for rapidly prototyping an idea for a component instead of setting up yet-another-js-build-system!
[0] https://buble.surge.sh/guide/
Edited to add: I've also used it successfully for some (unfortunately internal, I'd love to show you them) big production systems, where we had a team of 7 developers working on it at the end. Still in use now, and it was a breeze -- and runs extremely fast, UI-wise.
Opened an issue for it: https://github.com/sveltejs/svelte-hackernews/issues/10
Issue has been opened for it: https://github.com/Polymer/hn-polymer-2/issues/3
Why is that showing 93/100 in the list?
Each of the implementations were built at a completely different time by different authors and are not representative as official library implementations at all. In no way was it our intent to make it seem like a reference of performance comparison between the different libraries, so again I apologize if it comes across that way.
We do need to standardize each of the apps so that they can actually be compared, but until then we'll need to make sure that things are more transparent. In the next few days we'll add some changes to how we display each of the implementations for this [1].
We've discussed standardizing the specifications [1] for each of the apps which covers how they're hosted, how they fetch their data, etc... That's something we still need to do so hopefully sometime soon we'll have each of the apps standardized similarly.
[1] https://github.com/tastejs/hacker-news-pwas/issues/7#issueco...
I do agree though that these all are not good use cases for the frameworks - a news aggregation site doesn't have enough state or cross-application relationships to warrant the overhead of any of these framework. Especially in comparison to Hacker News - which is so minimalist as it is - adding to it can only really take away.
But at least Preact is also API compatible with React, so you can go from the worst to the best.
It's comparing load time, not performance.
(Also 'performance' is a broad term that encompasses load time. If a page loads faster it performs better).