mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +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:
@@ -186,7 +186,6 @@ exports.create = function ($container, list, opts) {
|
||||
|
||||
const slice = meta.filtered_list.slice(meta.offset, meta.offset + load_count);
|
||||
|
||||
const finish = blueslip.start_timing("ListWidget " + opts.name);
|
||||
let html = "";
|
||||
for (const item of slice) {
|
||||
const s = opts.modifier(item);
|
||||
@@ -202,8 +201,6 @@ exports.create = function ($container, list, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
finish();
|
||||
|
||||
$container.append($(html));
|
||||
meta.offset += load_count;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user