Don't re-compute display time when rendering a message a second time

Adding the display times to messages is very expensive (> 1s for 400
messages in Chrome on my machine).  This commit doesn't directly
address that issue, but does mitigate its affects on scrolling speed
when rendering the next chunk of the message list.  After this
commit, rendering a portion of the message list for the second time
only takes ~300ms.

(imported from commit b22badb5dcce69be297f6403b1cb40950e46376e)
This commit is contained in:
Zev Benjamin
2013-03-04 17:15:53 -05:00
parent ebabe0caeb
commit 4b3e4b118e

View File

@@ -16,6 +16,9 @@ function MessageList(table_name, opts) {
(function () { (function () {
function add_display_time(message, prev) { function add_display_time(message, prev) {
if (message.timestr !== undefined) {
return;
}
var two_digits = function (x) { return ('0' + x).slice(-2); }; var two_digits = function (x) { return ('0' + x).slice(-2); };
var time = new XDate(message.timestamp * 1000); var time = new XDate(message.timestamp * 1000);
var include_date = message.include_recipient; var include_date = message.include_recipient;