January 20, 2017 08:12AM
details: http://hg.nginx.org/njs/rev/8401ae77cf40
branches:
changeset: 303:8401ae77cf40
user: Igor Sysoev <igor@sysoev.ru>
date: Fri Jan 20 16:10:48 2017 +0300
description:
A small rbtree insert fixup optimization.

Thanks to ??? (Hong Zhi Dao).

diffstat:

nxt/nxt_rbtree.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 5db6d7af16b4 -r 8401ae77cf40 nxt/nxt_rbtree.c
--- a/nxt/nxt_rbtree.c Mon Jan 16 18:14:01 2017 +0300
+++ b/nxt/nxt_rbtree.c Fri Jan 20 16:10:48 2017 +0300
@@ -135,8 +135,12 @@ nxt_rbtree_insert_fixup(nxt_rbtree_node_
grandparent = parent->parent;
grandparent->color = NXT_RBTREE_RED;
nxt_rbtree_right_rotate(grandparent);
-
- continue;
+ /*
+ * nxt_rbtree_right_rotate() does not change node->parent
+ * color which is now black, so testing color is not required
+ * to return from function.
+ */
+ return;
}

} else {
@@ -156,7 +160,8 @@ nxt_rbtree_insert_fixup(nxt_rbtree_node_
grandparent->color = NXT_RBTREE_RED;
nxt_rbtree_left_rotate(grandparent);

- continue;
+ /* See the comment in the symmetric branch above. */
+ return;
}
}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] A small rbtree insert fixup optimization.

Igor Sysoev 1104 January 20, 2017 08:12AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 147
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready