Firebase load performance

女生的网名这么多〃 提交于 2019-12-08 07:38:52

问题


Simple console timing shows that fb loads much slower than desired (just 50 chat items).

load: 171.226ms
fbload: 1723.570ms 

load: 182.672ms
fbload: 2143.836ms

The normal load is from my mongodb and fbload is firebase. Despite my mongo being not denormalized fb is order of magnitude slower.

  1. Is there something I can do to increase performance?

  2. I'm using angularfire and I can load the initial from my own database and then replace it with the fb data. For this solution is there some way I can get the fb data to sync and bind onto existing dom elements as to avoid repainting the layout?

Code This is how I'm benching the fb time.

console.time('fbload')
$scope.chatLog = $firebase(fb.child('view/r/' + id).endAt().limit(50));
$scope.chatLog.$on('value', function () {
    console.timeEnd('fbload')
})

Edit:

My guess is that this is due to the websocket handshake. Firebase should initially just use xhr to get the data and only rely on websockets after connection. Still this needs a solution. Any ideas?

来源:https://stackoverflow.com/questions/23353991/firebase-load-performance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!