1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 15:53:12 +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
+2 -2
View File
@@ -694,7 +694,7 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
/* create hashtable pointers if it's NULL */
if (!pointers)
{
pointers = hashtable_new (16,
pointers = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
@@ -723,7 +723,7 @@ eval_expression (const char *expr, struct t_hashtable *pointers,
/* create hashtable extra_vars if it's NULL */
if (!extra_vars)
{
extra_vars = hashtable_new (16,
extra_vars = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+3 -3
View File
@@ -93,7 +93,7 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
new_hdata->plugin = plugin;
new_hdata->var_prev = (var_prev) ? strdup (var_prev) : NULL;
new_hdata->var_next = (var_next) ? strdup (var_next) : NULL;
new_hdata->hash_var = hashtable_new (16,
new_hdata->hash_var = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
@@ -101,7 +101,7 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
hashtable_set_pointer (new_hdata->hash_var,
"callback_free_value",
&hdata_free_var);
new_hdata->hash_list = hashtable_new (16,
new_hdata->hash_list = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
@@ -1039,7 +1039,7 @@ hdata_print_log ()
void
hdata_init ()
{
weechat_hdata = hashtable_new (16,
weechat_hdata = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
+2 -2
View File
@@ -402,7 +402,7 @@ gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
}
else if (conditions[0])
{
pointers = hashtable_new (16,
pointers = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
@@ -412,7 +412,7 @@ gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
hashtable_set (pointers, "window", window);
hashtable_set (pointers, "buffer", window->buffer);
}
extra_vars = hashtable_new (16,
extra_vars = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
+2 -2
View File
@@ -546,7 +546,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->highlight_tags_array = NULL;
/* hotlist */
new_buffer->hotlist_max_level_nicks = hashtable_new (8,
new_buffer->hotlist_max_level_nicks = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
@@ -558,7 +558,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->keys_count = 0;
/* local variables */
new_buffer->local_variables = hashtable_new (8,
new_buffer->local_variables = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
+2 -2
View File
@@ -706,7 +706,7 @@ gui_color_palette_alloc_structs ()
{
if (!gui_color_hash_palette_color)
{
gui_color_hash_palette_color = hashtable_new (16,
gui_color_hash_palette_color = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
@@ -717,7 +717,7 @@ gui_color_palette_alloc_structs ()
}
if (!gui_color_hash_palette_alias)
{
gui_color_hash_palette_alias = hashtable_new (16,
gui_color_hash_palette_alias = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
+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,