Welcome! Log In Create A New Profile

Advanced

[nginx] Core: slight optimization in ngx_chain_update_chains().

Maxim Dounin
November 11, 2016 02:12PM
details: http://hg.nginx.org/nginx/rev/40c2f3e06d23
branches:
changeset: 6797:40c2f3e06d23
user: hucongcong <hucong.c@foxmail.com>
date: Thu Nov 10 10:17:53 2016 +0800
description:
Core: slight optimization in ngx_chain_update_chains().

It is not necessary to traverse *busy and link the *out when *out is NULL.

diffstat:

src/core/ngx_buf.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)

diffs (30 lines):

diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c
--- a/src/core/ngx_buf.c
+++ b/src/core/ngx_buf.c
@@ -186,17 +186,19 @@ ngx_chain_update_chains(ngx_pool_t *p, n
{
ngx_chain_t *cl;

- if (*busy == NULL) {
- *busy = *out;
+ if (*out) {
+ if (*busy == NULL) {
+ *busy = *out;

- } else {
- for (cl = *busy; cl->next; cl = cl->next) { /* void */ }
+ } else {
+ for (cl = *busy; cl->next; cl = cl->next) { /* void */ }

- cl->next = *out;
+ cl->next = *out;
+ }
+
+ *out = NULL;
}

- *out = NULL;
-
while (*busy) {
cl = *busy;


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

[nginx] Core: slight optimization in ngx_chain_update_chains().

Maxim Dounin 523 November 11, 2016 02:12PM



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

Online Users

Guests: 252
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