lib/checkout: Optimize checkout by avoiding OstreeRepoFile recusion
Looking at `perf record ostree checkout`, some things stand out; e.g.: ``` + 27.63% 0.07% ostree libgio-2.0.so.0.5000.3 [.] g_file_enumerator_iterate + 22.74% 0.28% ostree libostree-1.so.1.0.0 [.] ostree_repo_file_tree_query_child + 13.74% 0.08% ostree libostree-1.so.1.0.0 [.] ot_variant_bsearch_str ``` The GIO abstractions are already fairly heavyweight, and `OstreeRepoFile` mallocs a lot too. Make things more efficient here by dropping the GIO bits for reading ostree data - we just read from the variants directly and iterate over them. The end result here is that according to perf we go from ~40% of our time in the kernel to ~70%, and things like `g_file_enumerator_iterate()` drop entirely out of the hot set. Closes: #848 Approved by: jlebon
This commit is contained in:
1 parent
7896bcbe65
commit
e6f17b949d
2 files changed
+97
-64
No files matched your search
@@ -90,6 +90,14 @@ _ostree_make_temporary_symlink_at (int tmp_dirfd,
|
||||
|
||||
GFileInfo * _ostree_header_gfile_info_new (mode_t mode, uid_t uid, gid_t gid);
|
||||
|
||||
static inline void
|
||||
_ostree_checksum_inplace_from_bytes_v (GVariant *csum_v, char *buf)
|
||||
{
|
||||
const guint8*csum = ostree_checksum_bytes_peek (csum_v);
|
||||
g_assert (csum);
|
||||
ostree_checksum_inplace_from_bytes (csum, buf);
|
||||
}
|
||||
|
||||
/* XX/checksum-2.extension, but let's just use 256 for a
|
||||
* bit of overkill.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user