diff options
author | Adam <Adam@anope.org> | 2010-11-13 15:20:56 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-12 19:33:58 -0500 |
commit | c792c7f62df41c48d0d813a809e5415cbefa38b2 (patch) | |
tree | f7778d83dba9092bdd04ec6cf568c427e34e3218 /modules | |
parent | e5127603642d3f04a21480697bdf59517775fd8b (diff) |
Switched the system for storing users, channels, and sesions to a patricia
tree from STL's unordered_map, which was giving horrible performance.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/core/bs_botlist.cpp | 8 | ||||
-rw-r--r-- | modules/core/cs_akick.cpp | 4 | ||||
-rw-r--r-- | modules/core/db_plain.cpp | 4 | ||||
-rw-r--r-- | modules/core/os_noop.cpp | 4 | ||||
-rw-r--r-- | modules/core/os_session.cpp | 4 | ||||
-rw-r--r-- | modules/core/os_staff.cpp | 4 | ||||
-rw-r--r-- | modules/core/os_userlist.cpp | 8 | ||||
-rw-r--r-- | modules/extra/db_mysql.cpp | 8 |
8 files changed, 22 insertions, 22 deletions
diff --git a/modules/core/bs_botlist.cpp b/modules/core/bs_botlist.cpp index 425cf48ab..a8487b03b 100644 --- a/modules/core/bs_botlist.cpp +++ b/modules/core/bs_botlist.cpp @@ -30,9 +30,9 @@ class CommandBSBotList : public Command return MOD_CONT; } - for (botinfo_map::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) + for (patricia_tree<BotInfo>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) { - BotInfo *bi = it->second; + BotInfo *bi = *it; if (!bi->HasFlag(BI_PRIVATE)) { @@ -47,9 +47,9 @@ class CommandBSBotList : public Command { u->SendMessage(BotServ, BOT_BOTLIST_PRIVATE_HEADER); - for (botinfo_map::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) + for (patricia_tree<BotInfo>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) { - BotInfo *bi = it->second; + BotInfo *bi = *it; if (bi->HasFlag(BI_PRIVATE)) { diff --git a/modules/core/cs_akick.cpp b/modules/core/cs_akick.cpp index 579c013f2..175b20047 100644 --- a/modules/core/cs_akick.cpp +++ b/modules/core/cs_akick.cpp @@ -207,9 +207,9 @@ class CommandCSAKick : public Command { /* Match against all currently online users with equal or * higher access. - Viper */ - for (user_map::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it) + for (patricia_tree<User>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it) { - User *u2 = it->second; + User *u2 = *it; if ((check_access(u2, ci, CA_FOUNDER) || get_access(u2, ci) >= get_access(u, ci)) && match_usermask(mask, u2)) { diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp index 1c8de7fee..19acd810d 100644 --- a/modules/core/db_plain.cpp +++ b/modules/core/db_plain.cpp @@ -924,9 +924,9 @@ class DBPlain : public Module FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteMetadata, na)); } - for (botinfo_map::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) + for (patricia_tree<BotInfo>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) { - BotInfo *bi = it->second; + BotInfo *bi = *it; db << "BI " << bi->nick << " " << bi->GetIdent() << " " << bi->host << " " << bi->created << " " << bi->chancount << " :" << bi->realname << endl; if (bi->HasFlag(BI_PRIVATE)) diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp index 04bf0a7e4..56b69fcb7 100644 --- a/modules/core/os_noop.cpp +++ b/modules/core/os_noop.cpp @@ -38,9 +38,9 @@ class CommandOSNOOP : public Command u->SendMessage(OperServ, OPER_NOOP_SET, server.c_str()); /* Kill all the IRCops of the server */ - for (user_map::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ) + for (patricia_tree<User>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it) { - User *u2 = it->second; + User *u2 = *it; ++it; if (u2 && is_oper(u2) && Anope::Match(u2->server->GetName(), server, true)) diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp index 17b2a7aa1..fc85c304b 100644 --- a/modules/core/os_session.cpp +++ b/modules/core/os_session.cpp @@ -134,9 +134,9 @@ class CommandOSSession : public Command u->SendMessage(OperServ, OPER_SESSION_LIST_HEADER, mincount); u->SendMessage(OperServ, OPER_SESSION_LIST_COLHEAD); - for (session_map::const_iterator it = SessionList.begin(), it_end = SessionList.end(); it != it_end; ++it) + for (patricia_tree<Session>::const_iterator it = SessionList.begin(), it_end = SessionList.end(); it != it_end; ++it) { - Session *session = it->second; + Session *session = *it; if (session->count >= mincount) u->SendMessage(OperServ, OPER_SESSION_LIST_FORMAT, session->count, session->host.c_str()); diff --git a/modules/core/os_staff.cpp b/modules/core/os_staff.cpp index f5c80b3ad..6b8b1cb43 100644 --- a/modules/core/os_staff.cpp +++ b/modules/core/os_staff.cpp @@ -33,9 +33,9 @@ class CommandOSStaff : public Command if (na) { /* We have to loop all users as some may be logged into an account but not a nick */ - for (user_map::iterator uit = UserListByNick.begin(), uit_end = UserListByNick.end(); uit != uit_end; ++uit) + for (patricia_tree<User>::const_iterator uit = UserListByNick.begin(), uit_end = UserListByNick.end(); uit != uit_end; ++uit) { - User *u2 = uit->second; + User *u2 = *uit; if (u2->Account() && u2->Account() == na->nc) { diff --git a/modules/core/os_userlist.cpp b/modules/core/os_userlist.cpp index 4c3355006..ab1f3adab 100644 --- a/modules/core/os_userlist.cpp +++ b/modules/core/os_userlist.cpp @@ -50,9 +50,9 @@ class CommandOSUserList : public Command { u->SendMessage(OperServ, OPER_USERLIST_HEADER); - for (user_map::const_iterator uit = UserListByNick.begin(), uit_end = UserListByNick.end(); uit != uit_end; ++uit) + for (patricia_tree<User>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it) { - User *u2 = uit->second; + User *u2 = *it; if (!pattern.empty()) { @@ -60,8 +60,8 @@ class CommandOSUserList : public Command if (!Anope::Match(mask, pattern)) continue; if (!Modes.empty()) - for (std::list<UserModeName>::iterator it = Modes.begin(), it_end = Modes.end(); it != it_end; ++it) - if (!u2->HasMode(*it)) + for (std::list<UserModeName>::iterator mit = Modes.begin(), mit_end = Modes.end(); mit != mit_end; ++mit) + if (!u2->HasMode(*mit)) continue; } u->SendMessage(OperServ, OPER_USERLIST_RECORD, u2->nick.c_str(), u2->GetIdent().c_str(), u2->GetDisplayedHost().c_str()); diff --git a/modules/extra/db_mysql.cpp b/modules/extra/db_mysql.cpp index fc9f47df9..6f18077f8 100644 --- a/modules/extra/db_mysql.cpp +++ b/modules/extra/db_mysql.cpp @@ -951,9 +951,9 @@ class DBMySQL : public Module FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteChannelMetadata, CurChannel)); } - for (botinfo_map::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) + for (patricia_tree<BotInfo>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) { - CurBot = it->second; + CurBot = *it; FOREACH_MOD(I_OnDatabaseWriteMetadata, OnDatabaseWriteMetadata(WriteBotMetadata, CurBot)); /* This is for the core bots, bots added by users are already handled by an event */ @@ -1525,8 +1525,8 @@ static void SaveDatabases() me->RunQuery("TRUNCATE TABLE `anope_bs_core`"); - for (botinfo_map::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) - me->OnBotCreate(it->second); + for (patricia_tree<BotInfo>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) + me->OnBotCreate(*it); me->RunQuery("TRUNCATE TABLE `anope_cs_info`"); me->RunQuery("TRUNCATE TABLE `anope_bs_badwords`"); |