Skip to contentSkip to conversation

Trivial Q about chunkd's main_loop

DISCUSSION Pete Zaitcev 2 participants 2 messages Apr 18, 2010

lore
Share & tools
lore
#0 lore raw

Is there a reason why the main_loop in chunkd uses a naked g_hash_table_lookup instead of srv_poll_lookup? Performance?

@@ -1681,8 +1681,7 @@ static int main_loop(void)

fired++;

- sp = g_hash_table_lookup(chunkd_srv.fd_info,
- GINT_TO_POINTER(pfd->fd));
+ sp = srv_poll_lookup(pfd->fd);
if (G_UNLIKELY(!sp)) {
/* BUG! */

-- Pete

#1 lore raw

Review static int main_loop(void) · line 1685

Quoted 11 lines · Pete Zaitcev

Is there a reason why the main_loop in chunkd uses a naked g_hash_table_lookup instead of srv_poll_lookup? Performance?

(quoted diff) +1 -2
@@ -1681,8 +1681,7 @@ static int main_loop(void)
 
  			fired++;
 
- 			sp = g_hash_table_lookup(chunkd_srv.fd_info,
-						GINT_TO_POINTER(pfd->fd));
+			sp = srv_poll_lookup(pfd->fd);
  			if (G_UNLIKELY(!sp)) {

Looks like it should be changed to call srv_poll_lookup(), indeed. srv_poll_lookup() is marked 'static', so there should not be any performance difference after the compiler's optimizer passes get finished with it.

Jeff