perf: Add a quick test to measure ssb.following performance.
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Build Tilde Friends / Build-All (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Build Tilde Friends / Build-All (push) Has been cancelled
				
			This commit is contained in:
		@@ -1607,4 +1607,23 @@ void tf_ssb_test_cli(const tf_test_options_t* options)
 | 
				
			|||||||
	tf_free(blob);
 | 
						tf_free(blob);
 | 
				
			||||||
	tf_free(id);
 | 
						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
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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);
 | 
					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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** @} */
 | 
					/** @} */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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, "invite", tf_ssb_test_invite, false);
 | 
				
			||||||
	_tf_test_run(options, "triggers", tf_ssb_test_triggers, 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, "cli", tf_ssb_test_cli, false);
 | 
				
			||||||
 | 
						_tf_test_run(options, "following_perf", tf_ssb_test_following_perf, true);
 | 
				
			||||||
	tf_printf("Tests completed.\n");
 | 
						tf_printf("Tests completed.\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user