Last active
August 29, 2015 14:03
-
-
Save kurorido/9c8fe308b8c2417a982a to your computer and use it in GitHub Desktop.
Test Query CouchBase Without View
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void testQueryCouchBaseWithoutView() { | |
print("Testing Query CouchBase without View..."); | |
CouchClient _dbclient; | |
CouchClient.connect([Uri.parse("http://10.1.4.112:8091/pools")], "default", "").then((CouchClient c) { | |
_dbclient = c; | |
}).then((_) { | |
int startTime = new DateTime.now().millisecondsSinceEpoch; | |
List<Future> futures = new List(); | |
for (var i = 0; i < 1000000; i++) { | |
futures.add(_dbclient.get(i.toString())); | |
} | |
return Future.wait(futures).then((_) { | |
int endTime = new DateTime.now().millisecondsSinceEpoch; | |
int timeCost = endTime - startTime; | |
print(timeCost.toString() + "ms"); | |
// Connect to Remote VM Couchbase server | |
// 1. 215955 ms | |
// 2. 314406 ms | |
// 3. 277412 ms | |
}).whenComplete(() { | |
_dbclient.close(); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment