FS#66687 - [shared-mime-info] fdatasync() is no longer disabled after the package switches to meson
Attached to Project:
Arch Linux
Opened by Chih-Hsuan Yen (yan12125) - Sunday, 17 May 2020, 12:34 GMT
Last edited by Andreas Radke (AndyRTR) - Monday, 18 May 2020, 11:08 GMT
Opened by Chih-Hsuan Yen (yan12125) - Sunday, 17 May 2020, 12:34 GMT
Last edited by Andreas Radke (AndyRTR) - Monday, 18 May 2020, 11:08 GMT
|
Details
Description:
To speed up /usr/bin/update-mime-database, ac_cv_func_fdatasync=no was added to prevent fdatasync() from being used [1]. After switching to meson [2], that option has no affects, and thus running update-mime-database.hook takes much longer time [3]. [1] https://bugs.archlinux.org/task/38836 [2] https://git.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/shared-mime-info&id=bfe4b10c671319c1739c4c7cd18270b06f28468b [3] https://bbs.archlinux.org/viewtopic.php?id=255817 Additional info: extra/shared-mime-info 2.0+1+g6bf9e4f-1 Steps to reproduce: Installing/upgrading any package with MIME data. For example `pacman -S shared-mime-info`. |
This task depends upon
Anyway, before the upstream issue is fixed, how about adding PKGSYSTEM_ENABLE_FSYNC=0 to update-mime-database.hook like I did in https://bbs.archlinux.org/viewtopic.php?pid=1905481#p1905481?
-n Only update if MIME-DIR/packages/ or a file in that directory is newer than MIME-DIR/version. This is useful for package
pre- and post-installation scripts.
Compare "time /usr/bin/update-mime-database -V /usr/share/mime" vs. "time /usr/bin/update-mime-database -Vn /usr/share/mime".
I guess it should be enough to add "-n" to the hook:
-Exec = /usr/bin/update-mime-database /usr/share/mime
+Exec = /usr/bin/update-mime-database -n /usr/share/mime
I found at least Fedora is doing it this way.
1. With `Exec = /usr/bin/time /usr/bin/update-mime-database /usr/share/mime` in the hook
0.29user 0.12system 0:38.05elapsed 1%CPU (0avgtext+0avgdata 66988maxresident)k
0inputs+8040outputs (0major+15459minor)pagefaults 0swaps
2. With `Exec = /usr/bin/time /usr/bin/update-mime-database -n /usr/share/mime` in the hook
0.27user 0.14system 0:39.58elapsed 1%CPU (0avgtext+0avgdata 66852maxresident)k
0inputs+8040outputs (0major+15456minor)pagefaults 0swaps
On the other hand, with `Exec = /usr/bin/time /usr/bin/env PKGSYSTEM_ENABLE_FSYNC=0 /usr/bin/update-mime-database /usr/share/mime`
0.23user 0.06system 0:00.30elapsed 99%CPU (0avgtext+0avgdata 66856maxresident)k
0inputs+8040outputs (0major+15519minor)pagefaults 0swaps
Environment: Western Digital hard disk WD10EZEX-08WN4A0 (7200rpm) + ext4 for rootfs
Exec = /usr/bin/time /usr/bin/env PKGSYSTEM_ENABLE_FSYNC=0 /usr/bin/update-mime-database -n /usr/share/mime` ?
0.24user 0.06system 0:00.51elapsed 59%CPU (0avgtext+0avgdata 66916maxresident)k
8inputs+8040outputs (0major+15523minor)pagefaults 0swaps
and should bring back old fast behavior.