mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-20 02:10:12 +00:00
Start with a file array with a resonable preallocated size
g_array_new() doesn't reserve any size by default, so during the initial population of the file array, we'll do more reallocs than strictly needed. We'll start with a reasonable preallocated size, in this case the number of files which we can get in a single chunk out of GIO. Signed-off-by: Federico Mena Quintero <federico@novell.com>
This commit is contained in:
parent
5110415684
commit
3232c469fc
@ -1111,7 +1111,7 @@ gtk_file_system_model_set_n_columns (GtkFileSystemModel *model,
|
|||||||
|
|
||||||
model->sort_list = _gtk_tree_data_list_header_new (n_columns, model->column_types);
|
model->sort_list = _gtk_tree_data_list_header_new (n_columns, model->column_types);
|
||||||
|
|
||||||
model->files = g_array_new (FALSE, FALSE, model->node_size);
|
model->files = g_array_sized_new (FALSE, FALSE, model->node_size, FILES_PER_QUERY);
|
||||||
/* add editable node at start */
|
/* add editable node at start */
|
||||||
g_array_set_size (model->files, 1);
|
g_array_set_size (model->files, 1);
|
||||||
memset (get_node (model, 0), 0, model->node_size);
|
memset (get_node (model, 0), 0, model->node_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user