summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes8
-rw-r--r--ev.c3
2 files changed, 7 insertions, 4 deletions
diff --git a/Changes b/Changes
index 0e7d962..7e88acf 100644
--- a/Changes
+++ b/Changes
@@ -1,8 +1,10 @@
Revision history for libev, a high-performance and full-featured event loop.
- - use 1-based heaps, simplifies code, reduces codesize, makes
- for better cache-efficiency and increases memory requirements
- by up to two pointers/loop.
+ - use 1-based 2-heap for EV_MINIMAL, simplifies code, reduces
+ codesize and makes for better cache-efficiency.
+ - use 3-based 4-heap for !EV_MINIMAL. this makes better use
+ of cpu cache lines and gives better growth behaviour than
+ 2-based heaps.
- fix a potential aliasing issue in ev_timer_again.
- add/document ev_periodic_at, retract direct access to ->at.
- improve ev_stat docs.
diff --git a/ev.c b/ev.c
index b576a86..5b8ba8d 100644
--- a/ev.c
+++ b/ev.c
@@ -810,6 +810,7 @@ downheap (WT *heap, int N, int k)
// find minimum child
if (expect_true (pos +3 < E))
{
+ /* fast path */
(minpos = pos + 0), (minat = (*minpos)->at);
if (pos [1]->at < minat) (minpos = pos + 1), (minat = (*minpos)->at);
if (pos [2]->at < minat) (minpos = pos + 2), (minat = (*minpos)->at);
@@ -817,9 +818,9 @@ downheap (WT *heap, int N, int k)
}
else
{
+ /* slow path */
if (pos >= E)
break;
-
(minpos = pos + 0), (minat = (*minpos)->at);
if (pos + 1 < E && pos [1]->at < minat) (minpos = pos + 1), (minat = (*minpos)->at);
if (pos + 2 < E && pos [2]->at < minat) (minpos = pos + 2), (minat = (*minpos)->at);