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

@@ -7,10 +7,11 @@
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <set>
#include <small/map.hpp>
#include <libtransmission/transmission.h> // priorities
#include <QAbstractItemModel>
@@ -470,7 +471,7 @@ void FileTreeModel::emitSubtreeChanged(QModelIndex const& idx, int first_column,
void FileTreeModel::twiddleWanted(QModelIndexList const& indices)
{
std::map<bool, QModelIndexList> wanted_indices;
auto wanted_indices = small::max_size_map<bool, QModelIndexList, 2U>{};
for (QModelIndex const& i : getOrphanIndices(indices))
{
@@ -489,7 +490,7 @@ void FileTreeModel::twiddleWanted(QModelIndexList const& indices)
void FileTreeModel::twiddlePriority(QModelIndexList const& indices)
{
std::map<int, QModelIndexList> priority_indices;
auto priority_indices = small::max_size_map<int, QModelIndexList, 8U>{};
for (QModelIndex const& i : getOrphanIndices(indices))
{