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:
Steve Howell
2021-01-31 12:57:52 +00:00
committed by Tim Abbott
parent 4bcf7131c1
commit 016038dcd1
9 changed files with 33 additions and 38 deletions

View File

@@ -112,11 +112,9 @@ exports.build_user_sidebar = function () {
const user_ids = buddy_data.get_filtered_and_sorted_user_ids(filter_text);
const finish = blueslip.start_timing("buddy_list.populate");
buddy_list.populate({
keys: user_ids,
blueslip.measure_time("buddy_list.populate", () => {
buddy_list.populate({keys: user_ids});
});
finish();
return user_ids; // for testing
};