friends

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
friends
// async test
req('friends.get', function(res) {
                        Console.time('Syncing contact list');
                        
                        var uids = Array.prototype.slice.call(res, 0);
                        var interval = setInterval(function() {
                                var uid, makeReq = false;
                                
                                if (uids.length === 0) {
                                        Console.timeEnd('Syncing contact list');
                                        
                                        clearInterval(interval);
                                        setTimeout(function() {
                                                friendsSyncProcess(userId);
                                        }, 5000);
                                        
                                        return;
                                }
                                
                                while (uids.length) {
                                        uid = uids.shift();
                                        if (typeof cache.users[uid] === 'undefined') {
                                                makeReq = true;
                                                break;
                                        }
                                }
                                
                                if (makeReq === false) {
                                        return;
                                }
                                
                                req('getProfiles', {'uids' : uid, 'fields' : 'first_name,last_name,domain,bdate,photo,photo_big,contacts'}, function(res) {
                                        Db.insertContact(userId, uid, res[0].first_name, res[0].last_name, JSON.stringify(res[0]), '', function(localId) {
                                                Console.log('User #' + uid + ' inserted as ' + localId);
                                                cache.users[uid] = res[0];
                                        }, dbFailFn);
                                }, function(err) {
                                        Console.log(err);
                                        Console.trace();
                                        
                                        uids.push(userId);
                                });
                        }, 350);
                });
ready
lala
alert(132)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.