1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 02:03:13 +02:00

core: use size of 32 for hashtables (instead of 4, 8 or 16)

A size of 32 will use a little more memory but will reduce collisions in key
hashs, and then length of linked lists inside hash structure (faster search in
hashtable).
This commit is contained in:
Sebastien Helleu
2013-01-26 19:26:43 +01:00
parent f4dce04723
commit 25eaec3864
16 changed files with 40 additions and 40 deletions
+6 -6
View File
@@ -428,7 +428,7 @@ irc_config_change_look_nick_color_force (void *data,
if (!irc_config_hashtable_nick_color_force)
{
irc_config_hashtable_nick_color_force = weechat_hashtable_new (8,
irc_config_hashtable_nick_color_force = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -581,7 +581,7 @@ irc_config_change_color_mirc_remap (void *data, struct t_config_option *option)
if (!irc_config_hashtable_color_mirc_remap)
{
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (8,
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -626,7 +626,7 @@ irc_config_change_color_nick_prefixes (void *data,
if (!irc_config_hashtable_nick_prefixes)
{
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (8,
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -1954,17 +1954,17 @@ irc_config_init ()
{
struct t_config_section *ptr_section;
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (8,
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_nick_color_force = weechat_hashtable_new (8,
irc_config_hashtable_nick_color_force = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (8,
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+2 -2
View File
@@ -224,7 +224,7 @@ irc_message_parse_to_hashtable (struct t_irc_server *server,
irc_message_parse (server, message, &tags, &message_without_tags, &nick,
&host, &command, &channel, &arguments);
hashtable = weechat_hashtable_new (8,
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -814,7 +814,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
if (weechat_irc_plugin->debug >= 2)
weechat_printf (NULL, "irc_message_split: message='%s'", message);
hashtable = weechat_hashtable_new (8,
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+1 -1
View File
@@ -4561,7 +4561,7 @@ irc_protocol_get_message_tags (const char *tags)
if (!tags || !tags[0])
return NULL;
hashtable = weechat_hashtable_new (8,
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+2 -2
View File
@@ -422,7 +422,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
{
if (items[i])
{
hash_cmd[i] = weechat_hashtable_new (8,
hash_cmd[i] = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
@@ -713,7 +713,7 @@ irc_redirect_stop (struct t_irc_redirect *redirect, const char *error)
* error or max count reached, then we run callback and remove
* redirect
*/
hashtable = weechat_hashtable_new (8,
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+4 -4
View File
@@ -958,17 +958,17 @@ irc_server_alloc (const char *name)
new_server->last_redirect = NULL;
new_server->notify_list = NULL;
new_server->last_notify = NULL;
new_server->join_manual = weechat_hashtable_new (4,
new_server->join_manual = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
NULL);
new_server->join_channel_key = weechat_hashtable_new (4,
new_server->join_channel_key = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
new_server->join_noswitch = weechat_hashtable_new (4,
new_server->join_noswitch = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -2093,7 +2093,7 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
ret_number = 1;
if (flags & IRC_SERVER_SEND_RETURN_HASHTABLE)
{
ret_hashtable = weechat_hashtable_new (8,
ret_hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+3 -3
View File
@@ -155,7 +155,7 @@ relay_irc_message_parse (const char *message)
hash_msg = NULL;
hash_parsed = NULL;
hash_msg = weechat_hashtable_new (8,
hash_msg = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -211,7 +211,7 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
if (pos)
pos[0] = '\0';
hashtable_in = weechat_hashtable_new (8,
hashtable_in = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -1574,7 +1574,7 @@ relay_irc_recv_one_msg (struct t_relay_client *client, char *data)
}
else if (!relay_irc_command_ignored (irc_command))
{
hash_redirect = weechat_hashtable_new (8,
hash_redirect = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+1 -1
View File
@@ -204,7 +204,7 @@ relay_config_change_irc_backlog_tags (void *data,
if (!relay_config_hashtable_irc_backlog_tags)
{
relay_config_hashtable_irc_backlog_tags = weechat_hashtable_new (8,
relay_config_hashtable_irc_backlog_tags = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+4 -4
View File
@@ -204,7 +204,7 @@ relay_weechat_alloc (struct t_relay_client *client)
RELAY_WEECHAT_DATA(client, password_ok) = (password && password[0]) ? 0 : 1;
RELAY_WEECHAT_DATA(client, compression) = 1;
RELAY_WEECHAT_DATA(client, buffers_sync) =
weechat_hashtable_new (16,
weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
@@ -213,7 +213,7 @@ relay_weechat_alloc (struct t_relay_client *client)
RELAY_WEECHAT_DATA(client, hook_signal_nicklist) = NULL;
RELAY_WEECHAT_DATA(client, hook_signal_upgrade) = NULL;
RELAY_WEECHAT_DATA(client, buffers_nicklist) =
weechat_hashtable_new (16,
weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -245,7 +245,7 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client,
RELAY_WEECHAT_DATA(client, compression) = weechat_infolist_integer (infolist, "compression");
/* sync of buffers */
RELAY_WEECHAT_DATA(client, buffers_sync) = weechat_hashtable_new (16,
RELAY_WEECHAT_DATA(client, buffers_sync) = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
@@ -268,7 +268,7 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client,
RELAY_WEECHAT_DATA(client, hook_signal_nicklist) = NULL;
RELAY_WEECHAT_DATA(client, hook_signal_upgrade) = NULL;
RELAY_WEECHAT_DATA(client, buffers_nicklist) =
weechat_hashtable_new (16,
weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+2 -2
View File
@@ -556,7 +556,7 @@ script_action_install (int quiet)
NULL);
if (filename)
{
options = weechat_hashtable_new (8,
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -986,7 +986,7 @@ script_action_show (const char *name, int quiet)
".repository");
if (filename)
{
options = weechat_hashtable_new (8,
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+3 -3
View File
@@ -1123,7 +1123,7 @@ script_repo_file_read (int quiet)
if (!script_repo_max_length_field)
{
script_repo_max_length_field = weechat_hashtable_new (16,
script_repo_max_length_field = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
@@ -1181,7 +1181,7 @@ script_repo_file_read (int quiet)
locale_language = strdup (locale);
}
descriptions = weechat_hashtable_new (8,
descriptions = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
@@ -1457,7 +1457,7 @@ script_repo_file_update (int quiet)
if (!filename)
return;
options = weechat_hashtable_new (8,
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+1 -1
View File
@@ -128,7 +128,7 @@ script_get_loaded_plugins_and_scripts ()
/* get loaded scripts */
if (!script_loaded)
{
script_loaded = weechat_hashtable_new (16,
script_loaded = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,