diff --git a/ChangeLog b/ChangeLog index 5edec29e2da6b1c8bd15f5722e748940976b35ad..3e2f791141e3105bef11c5cf0a54fade901a8ab4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-08-30 Benedikt Meurer <benny@xfce.org> + + * thunar/thunar-local-file.c(thunar_local_folder_infos_ready): Do not + compare the newly inserted files, as they are garantied to be + different from each other. + * thunar-vfs/thunar-vfs-info.c(thunar_vfs_info_matches): Move the URI + comparison to the end as that takes most of the time. + * thunar-vfs/thunar-vfs-listdir-job.c(thunar_vfs_listdir_job_execute): + Pre-sort the names in ascending order to get faster inserts for the + usual case where the user sorts its views by name. + 2005-08-30 Benedikt Meurer <benny@xfce.org> * thunar/thunar-properties-dialog.c: Adjust the "editability" of the diff --git a/thunar-vfs/thunar-vfs-info.c b/thunar-vfs/thunar-vfs-info.c index db192779101323ceed4a5cd184b2c2f9ec1cf15d..691f5d040b3390e20f6779d5b69a3602886caa85 100644 --- a/thunar-vfs/thunar-vfs-info.c +++ b/thunar-vfs/thunar-vfs-info.c @@ -659,8 +659,7 @@ thunar_vfs_info_matches (const ThunarVfsInfo *a, g_return_val_if_fail (a->ref_count > 0, FALSE); g_return_val_if_fail (b->ref_count > 0, FALSE); - return thunar_vfs_uri_equal (a->uri, b->uri) - && a->type == b->type + return a->type == b->type && a->mode == b->mode && a->flags == b->flags && a->uid == b->uid @@ -671,7 +670,8 @@ thunar_vfs_info_matches (const ThunarVfsInfo *a, && a->ctime == b->ctime && a->inode == b->inode && a->device == b->device - && a->mime_info == b->mime_info; + && a->mime_info == b->mime_info + && thunar_vfs_uri_equal (a->uri, b->uri); } diff --git a/thunar-vfs/thunar-vfs-listdir-job.c b/thunar-vfs/thunar-vfs-listdir-job.c index 881a10914f6e3400938fec60b6350e5b4689d5a3..4d2db026467862cef726520d240a6a0f3b2088eb 100644 --- a/thunar-vfs/thunar-vfs-listdir-job.c +++ b/thunar-vfs/thunar-vfs-listdir-job.c @@ -159,6 +159,15 @@ thunar_vfs_listdir_job_finalize (ExoObject *object) +static gint +namecmp (gconstpointer name_a, + gconstpointer name_b) +{ + return -1 * strcmp (name_a, name_b); +} + + + static void thunar_vfs_listdir_job_execute (ThunarVfsJob *job) { @@ -189,7 +198,7 @@ thunar_vfs_listdir_job_execute (ThunarVfsJob *job) * disk seeking. */ while (_thunar_vfs_sysdep_readdir (dp, &d_buffer, &d, &error) && d != NULL) - names = g_slist_insert_sorted (names, g_string_chunk_insert (names_chunk, d->d_name), (GCompareFunc) strcmp); + names = g_slist_insert_sorted (names, g_string_chunk_insert (names_chunk, d->d_name), namecmp); closedir (dp); diff --git a/thunar/thunar-local-folder.c b/thunar/thunar-local-folder.c index 04b8f4fda6ecabfc2ca3e194a01fa0d94a453170..687ab1f11e26e1bc04412fbbf19ccf96612d39c5 100644 --- a/thunar/thunar-local-folder.c +++ b/thunar/thunar-local-folder.c @@ -257,6 +257,7 @@ thunar_local_folder_infos_ready (ThunarVfsJob *job, ThunarLocalFolder *local_folder) { ThunarFile *file; + GSList *existing_files = local_folder->files; GSList *nfiles = NULL; GSList *lp; GSList *p; @@ -272,7 +273,7 @@ thunar_local_folder_infos_ready (ThunarVfsJob *job, file = thunar_local_file_get_for_info (lp->data); /* verify that we don't already have that file */ - for (p = local_folder->files; p != NULL; p = p->next) + for (p = existing_files; p != NULL; p = p->next) if (G_UNLIKELY (p->data == file)) break; if (G_UNLIKELY (p != NULL))