mirror of
https://github.com/systemd/systemd.git
synced 2024-11-08 11:27:32 +03:00
sd-event: don't provide priority stability
Currently, we guarantee that if two event-sources with the same priority fire at the same time, they're always dispatched in the same order. While this might sound nice in theory, there's is little benefit in providing stability on that level. We have no control over the order the events are reported, hence, we cannot guarantee that we get notified about both at the same time. By dropping the stability guarantee, we loose roughly 10% Heap swaps in the prioq on a desktop cold-boot. Krzysztof Kotlenga even reported up to 20% on his tests. This sounds worth optimizing, so drop the stability guarantee.
This commit is contained in:
parent
8a9d23e446
commit
6fe869c251
@ -242,12 +242,6 @@ static int pending_prioq_compare(const void *a, const void *b) {
|
||||
if (x->pending_iteration > y->pending_iteration)
|
||||
return 1;
|
||||
|
||||
/* Stability for the rest */
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -277,12 +271,6 @@ static int prepare_prioq_compare(const void *a, const void *b) {
|
||||
if (x->priority > y->priority)
|
||||
return 1;
|
||||
|
||||
/* Stability for the rest */
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -310,12 +298,6 @@ static int earliest_time_prioq_compare(const void *a, const void *b) {
|
||||
if (x->time.next > y->time.next)
|
||||
return 1;
|
||||
|
||||
/* Stability for the rest */
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -343,12 +325,6 @@ static int latest_time_prioq_compare(const void *a, const void *b) {
|
||||
if (x->time.next + x->time.accuracy > y->time.next + y->time.accuracy)
|
||||
return 1;
|
||||
|
||||
/* Stability for the rest */
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -370,12 +346,6 @@ static int exit_prioq_compare(const void *a, const void *b) {
|
||||
if (x->priority > y->priority)
|
||||
return 1;
|
||||
|
||||
/* Stability for the rest */
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user