by bdamos · 11y ago · 0 comments
1) Linking to the original HN hiring post is helpful, and
2) I'm on a poor internet connection now, and this page took about a minute to load. http://hnhiring.com/ and the original July 2015 thread (https://news.ycombinator.com/item?id=9812245) load in ~5 seconds.
Hopefully it'll be improved at some point, especially given how bad the HN markup is (fun fact: all comments are at the same level in the dom; the indentation is achieved via a blank gif with a width property).
replace lots of these:
return $http.get('https://hacker-news.firebaseio.com/v0/user/'+name+' + '/.json');
with return $q(function(resolve, reject){
new Firebase('https://hackernews.firebaseio.com/v0/user/').child(name).on('value', function(snap) {
resolve(snap.val());
}, /*error handler here too*/)
})
https://www.firebase.com/blog/2014-10-07-hacker-news-api-is-firebase.html
https://docs.angularjs.org/api/ng/service/$q
(yes the HN API design is a little funky though, but you can definitely improve the loading times with websockets)The websocket API is the main selling point of Firebase, but I guess you were not actively looking to use Firebase in a product, rather, it was a necessity from HN API. Good luck! Don't hesitate to contact us.
What's the total size of the jobs data? Would it be possible to grab all the JSON from the API, concatenate it and then self-host it as a single file? I imagine a $5 DO droplet with nginx would suffice for that.
It looks like firebase isn't even gzipping the JSON.