mirror of https://github.com/zulip/zulip.git
53b5768b14
When we don't already have old messages in cache, we need to fetch data from the database and create dictionaries for the cache. This commit makes that process work in 50ms, instead of 130ms, for the data set in test_bulk_message_fetching(), which is 602 records. Before this commit we had about 132 microseconds of unnecessary churn per message, because we were fetching DB fields we didn't need and incurring the cost of the Django ORM. Now we use values() to get only the columns we need, and we take advantage of previous commits that make our code less OO and more function-driven, so we can pass the values directly to build_message_dict() without having to create objects. A couple caveats on this commit: 1) I haven't been able to get good measurements on the overall effect on get_old_messages_backend(). If you kill the cache to force DB queries, you introduce noise related to sessions and user profiles. 2) Look at the long comment in this commit related to re-rendering messages in this codepath. The problem precedes this commit. (imported from commit dcb64aa9416f0e9583355ddd6dc3adfa746b9fc7) |
||
---|---|---|
.. | ||
fixtures | ||
lib | ||
management | ||
migrations | ||
templatetags | ||
tests/frontend | ||
views | ||
worker | ||
__init__.py | ||
context_processors.py | ||
decorator.py | ||
exceptions.py | ||
filters.py | ||
finders.py | ||
forms.py | ||
handlers.py | ||
middleware.py | ||
models.py | ||
openid.py | ||
retention_policy.py | ||
static_header.txt | ||
storage.py | ||
tests.py | ||
tornado_callbacks.py | ||
tornadoviews.py |