optimise loops in ngx_http_upstream_init_ketama_chash()