[asterisk-commits] dlee: branch dlee/performance r399528 - /team/dlee/performance/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 20 10:43:27 CDT 2013


Author: dlee
Date: Fri Sep 20 10:43:26 2013
New Revision: 399528

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399528
Log:
Comments; clean up

Modified:
    team/dlee/performance/main/stasis.c
    team/dlee/performance/main/stasis_message_router.c

Modified: team/dlee/performance/main/stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/stasis.c?view=diff&rev=399528&r1=399527&r2=399528
==============================================================================
--- team/dlee/performance/main/stasis.c (original)
+++ team/dlee/performance/main/stasis.c Fri Sep 20 10:43:26 2013
@@ -282,6 +282,13 @@
 	ast_uuid_generate_str(sub->uniqueid, sizeof(sub->uniqueid));
 
 	if (needs_mailbox) {
+		/* With a small number of subscribers, a thread-per-sub is
+		 * acceptable. If our usage changes so that we have larger
+		 * numbers of subscribers, we'll probably want to consier
+		 * a threadpool. We had that originally, but with so few
+		 * subscribers it was actually a performance loss instead of
+		 * a gain.
+		 */
 		sub->mailbox = ast_taskprocessor_get(sub->uniqueid,
 			TPS_REF_DEFAULT);
 		if (!sub->mailbox) {
@@ -728,11 +735,6 @@
 	ast_log(LOG_ERROR, "Use of %s() before init/after destruction\n", name);
 }
 
-/*! \brief Shutdown function */
-static void stasis_exit(void)
-{
-}
-
 /*! \brief Cleanup function for graceful shutdowns */
 static void stasis_cleanup(void)
 {
@@ -745,7 +747,6 @@
 
 	/* Be sure the types are cleaned up after the message bus */
 	ast_register_cleanup(stasis_cleanup);
-	ast_register_atexit(stasis_exit);
 
 	if (stasis_config_init() != 0) {
 		ast_log(LOG_ERROR, "Stasis configuration failed\n");

Modified: team/dlee/performance/main/stasis_message_router.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/stasis_message_router.c?view=diff&rev=399528&r1=399527&r2=399528
==============================================================================
--- team/dlee/performance/main/stasis_message_router.c (original)
+++ team/dlee/performance/main/stasis_message_router.c Fri Sep 20 10:43:26 2013
@@ -45,8 +45,11 @@
 };
 
 struct route_table {
+	/*! Current number of entries in the route table */
 	size_t current_size;
+	/*! Allocated number of entires in the route table */
 	size_t max_size;
+	/*! The route table itself */
 	struct stasis_message_route routes[];
 };
 
@@ -98,6 +101,12 @@
 {
 	size_t i;
 
+	/* While a linear search for routes may seem very inefficient, most
+	 * route tables have six routes or less. For such small data, it's
+	 * hard to beat a linear search. If we start having larger route
+	 * tables, then we can look into containers with more efficient
+	 * lookups.
+	 */
 	for (i = 0; i < table->current_size; ++i) {
 		if (table->routes[i].message_type == message_type) {
 			return &table->routes[i];




More information about the asterisk-commits mailing list