mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd::stats: Simplify f7945918c; eliminate sort.
This commit is contained in:
parent
4d48be4aa6
commit
099c7754ff
1 changed files with 5 additions and 10 deletions
|
@ -115,17 +115,13 @@ ircd::stats::item<void>::item(const std::type_index &type,
|
|||
NAME_MAX_LEN
|
||||
};
|
||||
|
||||
static const auto less
|
||||
{
|
||||
[](const auto &a, const auto &b)
|
||||
{
|
||||
return a->name < b->name;
|
||||
}
|
||||
};
|
||||
|
||||
const auto exists
|
||||
{
|
||||
std::binary_search(begin(items), end(items), this, less)
|
||||
end(items) != std::find_if(begin(items), end(items), [this]
|
||||
(const auto &item)
|
||||
{
|
||||
return item->name == this->name;
|
||||
})
|
||||
};
|
||||
|
||||
if(unlikely(exists))
|
||||
|
@ -139,7 +135,6 @@ ircd::stats::item<void>::item(const std::type_index &type,
|
|||
items.reserve(4096);
|
||||
|
||||
items.emplace_back(this);
|
||||
std::sort(begin(items), end(items), less);
|
||||
}
|
||||
|
||||
ircd::stats::item<void>::~item()
|
||||
|
|
Loading…
Reference in a new issue