diff --git a/src/ssb.tests.c b/src/ssb.tests.c index 5b942fc8..7a77fa90 100644 --- a/src/ssb.tests.c +++ b/src/ssb.tests.c @@ -1607,4 +1607,23 @@ void tf_ssb_test_cli(const tf_test_options_t* options) tf_free(blob); tf_free(id); } + +void tf_ssb_test_following_perf(const tf_test_options_t* options) +{ + uv_loop_t loop = { 0 }; + uv_loop_init(&loop); + + tf_ssb_t* ssb = tf_ssb_create(&loop, NULL, "db.sqlite", NULL); + + uint64_t start = uv_hrtime(); + const char** ids = tf_ssb_db_get_all_visible_identities(ssb, 2); + tf_free(ids); + uint64_t end = uv_hrtime(); + tf_printf("completed in %.3fs\n", (end - start) / 1e9); + + tf_ssb_destroy(ssb); + + uv_run(&loop, UV_RUN_DEFAULT); + uv_loop_close(&loop); +} #endif diff --git a/src/ssb.tests.h b/src/ssb.tests.h index 9d9f109f..76d83f6d 100644 --- a/src/ssb.tests.h +++ b/src/ssb.tests.h @@ -95,4 +95,10 @@ void tf_ssb_test_triggers(const tf_test_options_t* options); */ void tf_ssb_test_cli(const tf_test_options_t* options); +/** +** Test following performance. +** @param options The test options. +*/ +void tf_ssb_test_following_perf(const tf_test_options_t* options); + /** @} */ diff --git a/src/tests.c b/src/tests.c index 03e0dfca..9b8a68ad 100644 --- a/src/tests.c +++ b/src/tests.c @@ -1080,6 +1080,7 @@ void tf_tests(const tf_test_options_t* options) _tf_test_run(options, "invite", tf_ssb_test_invite, false); _tf_test_run(options, "triggers", tf_ssb_test_triggers, false); _tf_test_run(options, "cli", tf_ssb_test_cli, false); + _tf_test_run(options, "following_perf", tf_ssb_test_following_perf, true); tf_printf("Tests completed.\n"); #endif }