[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#49547] [PATCH v2 2/4] home-services: Add home-run-on-change-service
From: |
Maxime Devos |
Subject: |
[bug#49547] [PATCH v2 2/4] home-services: Add home-run-on-change-service-type |
Date: |
Wed, 14 Jul 2021 12:41:35 +0200 |
User-agent: |
Evolution 3.34.2 |
Andrew Tropin schreef op ma 05-07-2021 om 18:39 [+0300]:
> + (define (equal-regulars? file1 file2)
> + "Check if FILE1 and FILE2 are bit for bit identical."
> + (let* ((cmp-binary #$(file-append
> + (@ (gnu packages base) diffutils) "/bin/cmp"))
> + (status (system* cmp-binary file1 file2)))
> + (= status 0)))
Is there any particular reason to shell out to "cmp" instead
of doing the comparison in Guile? Starting a process isn't
the most efficient thing.
Try "time /run/current-system/profile/bin echo", on my system,
it takes about 2--3 milliseconds for "echo" to finish
even though it only had to print a newline character.
Compare with "time echo" (to use the shell built-in "echo"),
it takes 0.000s seconds on my system.
3 milliseconds isn't much by itself, but this can accumulate,
so I would implement the comparison in Guile.
As an optimisation, you could look at the value returned by "lstat".
If the 'size' is different, then 'equal-regulars?' can return #f
without reading the file. If the 'inode' and 'device' are equal,
then 'equal-regulars?' can return #t I think (at least on conventional
file systems like btrfs and ext4).
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part
- [bug#49419] [PATCH 1/4] home-services: Add most essential home services, (continued)
- [bug#49419] [PATCH 2/4] home-services: Add home-run-on-change-service-type, Andrew Tropin, 2021/07/05
- [bug#49419] [PATCH 3/4] home-services: Add home-provenance-service-type, Andrew Tropin, 2021/07/05
- [bug#49419] [PATCH 4/4] home-services: Add fold-home-service-types function, Andrew Tropin, 2021/07/05
- [bug#49419] [PATCH v2 0/4] Essential home services, Andrew Tropin, 2021/07/13
- [bug#49547] [PATCH v2 2/4] home-services: Add home-run-on-change-service-type, Andrew Tropin, 2021/07/13
[bug#49549] [PATCH v2 4/4] home-services: Add fold-home-service-types function, Andrew Tropin, 2021/07/13
[bug#49568] Testing reply without debbugs address, Andrew Tropin, 2021/07/15
[bug#49419] [PATCH v3 0/4] Essential home services, Andrew Tropin, 2021/07/19
- [bug#49419] [PATCH v3 4/4] home-services: Add fold-home-service-types function, Andrew Tropin, 2021/07/19
- [bug#49419] [PATCH v3 1/4] home-services: Add most essential home services, Andrew Tropin, 2021/07/19
- [bug#49419] [PATCH v3 3/4] home-services: Add home-provenance-service-type, Andrew Tropin, 2021/07/19
- [bug#49419] [PATCH v3 2/4] home-services: Add home-run-on-change-service-type, Andrew Tropin, 2021/07/19
- [bug#49419] [PATCH 0/4] Essential home services, Ludovic Courtès, 2021/07/21