Skip to content

Instantly share code, notes, and snippets.

@kurorido
Last active August 29, 2015 14:03
Show Gist options
  • Save kurorido/9c8fe308b8c2417a982a to your computer and use it in GitHub Desktop.
Save kurorido/9c8fe308b8c2417a982a to your computer and use it in GitHub Desktop.
Test Query CouchBase Without View
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