mirror of
https://github.com/zulip/zulip.git
synced 2025-11-20 22:48:16 +00:00
Using lightweight objects will speed up adding new users to realms. We also sort the query results, which lets us itertools.groupby to more efficiently build the data structure. Profiling on a large data set shows about a 25x speedup for this function, and before the optimization, this function accounts for most of the time spend in bulk_add_subscriptions. There's a lot less memory to allocate. I didn't measure the memory difference. When we test-deployed this to chat.zulip.org, we got about a 6x speedup.
165 KiB
165 KiB