During work on better verbose output, I found a regression between
v2.40 and v2.41 (and v2.42). In the new version, hardlink is 3-4 times
slower.
The problem is in the function where we verify signals. It calls the
function signal() even though no signal is delivered. It's called in
code loops where hardlink scans files, making it a performance-sensitive
area.
Another significant performance improvement is using an inline function
for handle_interrupt().
This simple patch improves hardlink performance by 10 times.
Fixes: http://github.com/util-linux/util-linux/commit/1453200e22dd4ec858be027653c167225f2fb358
Signed-off-by: Karel Zak <kzak@redhat.com>
/**
* handle_interrupt - Handle a signal
*/
-static void handle_interrupt(void)
+static inline void handle_interrupt(void)
{
switch (last_signal) {
+ case 0:
+ break;
case SIGUSR1:
print_stats();
putchar('\n');