mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
blueslip: Add measure_time wrapper.
Now when we want to measure how long a block of code takes to execute, we just wrap it with `blueslip.measure_time`, instead of the awkward idiom from my original commit of getting a callback function. My rationale for the original scheme was that I wanted to minimize diffs and avoid changing `const` to `let` in a few cases, but I believe now that the function wrapper is nicer. In a few cases I just removed the blueslip timing code, since I was able to confirm on czo that the times were pretty minimal.
This commit is contained in:
@@ -400,15 +400,16 @@ function get_stream_id_buckets(stream_ids, query) {
|
||||
}
|
||||
|
||||
exports.populate_stream_settings_left_panel = function () {
|
||||
const finish = blueslip.start_timing("render left panel");
|
||||
const sub_rows = stream_data.get_updated_unsorted_subs();
|
||||
let html;
|
||||
blueslip.measure_time("render left panel", () => {
|
||||
const sub_rows = stream_data.get_updated_unsorted_subs();
|
||||
|
||||
const template_data = {
|
||||
subscriptions: sub_rows,
|
||||
};
|
||||
const template_data = {
|
||||
subscriptions: sub_rows,
|
||||
};
|
||||
|
||||
const html = render_subscriptions(template_data);
|
||||
finish();
|
||||
html = render_subscriptions(template_data);
|
||||
});
|
||||
|
||||
ui.get_content_element($("#subscriptions_table .streams-list")).html(html);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user