Welcome! Log In Create A New Profile

Advanced

[njs] A small rbtree delete fixup optimization.

May 29, 2017 03:24AM
details: http://hg.nginx.org/njs/rev/c0bdd23e740e
branches:
changeset: 345:c0bdd23e740e
user: Igor Sysoev <igor@sysoev.ru>
date: Mon May 29 10:17:36 2017 +0300
description:
A small rbtree delete fixup optimization.

Setting node color to black is not required here because
it is already black. Besides in the original algorithm
the node pointer is discarded and the node is set to tree
root just to quit the loop.

Thanks to ??? (Hong Zhi Dao).

diffstat:

nxt/nxt_rbtree.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 7f1f3dcb278f -r c0bdd23e740e nxt/nxt_rbtree.c
--- a/nxt/nxt_rbtree.c Sat May 27 18:02:09 2017 +0300
+++ b/nxt/nxt_rbtree.c Mon May 29 10:17:36 2017 +0300
@@ -402,7 +402,7 @@ nxt_rbtree_delete_fixup(nxt_rbtree_t *tr

nxt_rbtree_left_rotate(parent);

- break;
+ return;

} else {
sibling = parent->left;
@@ -440,7 +440,7 @@ nxt_rbtree_delete_fixup(nxt_rbtree_t *tr

nxt_rbtree_right_rotate(parent);

- break;
+ 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 delete fixup optimization.

Igor Sysoev 786 May 29, 2017 03:24AM



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

Online Users

Guests: 99
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready