sm00th / bitlbee-discord

Bitlbee plugin for Discord (http://discordapp.com)
GNU General Public License v2.0
291 stars 27 forks source link

Use guint64 to store user ids, speeds up get_user(...SEARCH_ID) #165

Closed dequis closed 6 years ago

dequis commented 6 years ago

Second to last of today's optimizations, also probably not as meaningful as linked list tweaks in bitlbee, but it brought a guild sync of 50k members from 162 to 13 seconds (inside callgrind, which slows everything down. I don't know the time for that guild inside callgrind without any optimizations, probably 10 or 20 minutes)

Callgraph that motivated this change follows. cmp_user_id and its corresponding g_slist_find_custom both pretty much vanish after applying this. I expected needing to get rid of linked lists in here too, but it doesn't look like it will be necessary (eion says that he has hash tables for everything in )

vbkh4

EionRobb commented 6 years ago

(eion says that he has hash tables for everything in )

@EionRobb uses hash tables for storing users in purple-discord

dequis commented 6 years ago

@dequis forgot to finish that sentence before pressing submit and apologizes

sm00th commented 6 years ago

This actually breaks most of get_user(..., SEARCH_ID) calls because this PR doesn't convert id's to guint64 in those. This breakage is likely to be the main source of speedup seen and the impact is likely to be less if done right. As agreed with @dequis on irc closing this one for now, will likely convert bitlbee-discord to use hash-tables later which should be a decent improvement and will probably include this id typechange as well.