perf: prefer small containers (#6542)

* perf: make pref_is_savable() constexpr

* refactor: use std::vector in tr_torrents::removedSince()

* chore: remove unused typedef in OptionsDialog

* perf: use std::vector in tr_num_parse_range()

* perf: use small::max_size_set in FileTreeItem::update()

* perf: use small:set in Wishlist::next()

* perf: use small:map in FilterBar

* perf: use small::map for counts in tr_logAddMessage()

* perf: use small::max_size_map in FileTreeModel::twiddleWanted()

perf: use small::max_size_map in FileTreeModel::twiddlePriority()

* perf: use a std::array instead of std::map in TorrentFilter::update()

* perf: use a std::array instead of std::map in TorrentSorter::set_mode()

* perf: use a std::array instead of std::map in TorrentSorter::update()

* perf: use small::set in Application::Impl::on_rpc_changed_idle()

* perf: use std::array for MessageLogColumnsModel::level_names_

* fixup! perf: use std::array for MessageLogColumnsModel::level_names_

* fixup! perf: use small::map for counts in tr_logAddMessage()
This commit is contained in:
Charles Kerr
2024-01-27 09:33:12 -06:00
committed by GitHub
parent 9f77ef9c7a
commit a51f08e532
16 changed files with 97 additions and 66 deletions

View File

@@ -493,18 +493,20 @@ std::vector<int> tr_num_parse_range(std::string_view str)
{
using namespace tr_num_parse_range_impl;
auto values = std::set<int>{};
auto values = std::vector<int>{};
auto token = std::string_view{};
auto range = number_range{};
while (tr_strv_sep(&str, &token, ',') && parseNumberSection(token, range))
{
for (auto i = range.low; i <= range.high; ++i)
{
values.insert(i);
values.emplace_back(i);
}
}
return { std::begin(values), std::end(values) };
std::sort(std::begin(values), std::end(values));
values.erase(std::unique(std::begin(values), std::end(values)), std::end(values));
return values;
}
// ---