Hello,
I have a repository of 2000 files over NFS. update and status are very slow. I have strace/truss it and found a lot of stat calls. I think this just kill performance on a network filesystem. When doing a status, each file is stat'ed 4 times in a row. The following patch saves 2 calls. The 1 remaining is triggered by an assert_path_is_file in calculate_ident. I don't know if it's good, but on my workspace, it saves a lot of stat calls. It goes from ~8000 to ~4000. This almost saves 15% of the time to do a status. On a local filesystem, this makes no difference at all. (If it worths it, please let me push :) -- Benoît Dejean GNOME http://www.gnomefr.org/ LibGTop http://directory.fsf.org/libgtop.html
# # old_revision [5af0ed3151ef2c1ad92a4b353ffd7b86dcd6a4d3] # # patch "file_io.cc" # from [1edaa600f491b3cddb7628be8f0ab5d218971815] # to [60011f929084283e969ee8a5b9d591d43edb86af] # # patch "file_io.hh" # from [a9c4eac0ba8fd78a612dc775dcef76424769e2be] # to [2c7717337282a9f47e587ae7095b07d11b602f9c] # # patch "work.cc" # from [9b78a7cb064436d0eed809eaa14c46b548b46096] # to [776774635a7ac315d0f22c8386145569e5813cdb] # ============================================================ --- file_io.cc 1edaa600f491b3cddb7628be8f0ab5d218971815 +++ file_io.cc 60011f929084283e969ee8a5b9d591d43edb86af @@ -556,7 +556,13 @@ ident_existing_file(file_path const & p, bool ident_existing_file(file_path const & p, file_id & ident) { - switch (get_path_status(p)) + return ident_existing_file(p, ident, get_path_status(p)); +} + +bool +ident_existing_file(file_path const & p, file_id & ident, path::status status) +{ + switch (status) { case path::nonexistent: return false; ============================================================ --- file_io.hh a9c4eac0ba8fd78a612dc775dcef76424769e2be +++ file_io.hh 2c7717337282a9f47e587ae7095b07d11b602f9c @@ -13,6 +13,7 @@ #include "vocab.hh" #include "paths.hh" #include "sanity.hh" +#include "platform.hh" // this layer deals with talking to the filesystem, loading and saving // files, walking trees, etc. @@ -116,6 +117,8 @@ bool ident_existing_file(file_path const bool ident_existing_file(file_path const & p, file_id & ident); +bool ident_existing_file(file_path const & p, file_id & ident, path::status status); + void calculate_ident(file_path const & file, hexenc<id> & ident); ============================================================ --- work.cc 9b78a7cb064436d0eed809eaa14c46b548b46096 +++ work.cc 776774635a7ac315d0f22c8386145569e5813cdb @@ -1179,14 +1179,16 @@ workspace::update_current_roster_from_fi ros.get_name(nid, sp); file_path fp(sp); + const path::status status(get_path_status(fp)); + if (is_dir_t(node)) { - if (!path_exists(fp)) + if (status == path::nonexistent) { W(F("missing directory '%s'") % (fp)); missing_items++; } - else if (!directory_exists(fp)) + else if (status != path::directory) { W(F("not a directory '%s'") % (fp)); missing_items++; @@ -1199,19 +1201,19 @@ workspace::update_current_roster_from_fi if (inodeprint_unchanged(ipm, fp)) continue; - if (!path_exists(fp)) + if (status == path::nonexistent) { W(F("missing file '%s'") % (fp)); missing_items++; } - else if (!file_exists(fp)) + else if (status != path::file) { W(F("not a file '%s'") % (fp)); missing_items++; } file_t file = downcast_to_file_t(node); - ident_existing_file(fp, file->content); + ident_existing_file(fp, file->content, status); } }
signature.asc
Description: Ceci est une partie de message numériquement signée
_______________________________________________ Monotone-devel mailing list Monotone-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/monotone-devel