Use remove/push combination instead of <= for performance

This commit is contained in:
Tatsuhiro Tsujikawa 2015-08-18 00:12:04 +09:00
parent 627d04fe6b
commit 6a511aef0a

View File

@ -36,7 +36,7 @@ static int stream_weight_less(const void *lhsx, const void *rhsx) {
lhs = nghttp2_struct_of(lhsx, nghttp2_stream, pq_entry);
rhs = nghttp2_struct_of(rhsx, nghttp2_stream, pq_entry);
return lhs->cycle <= rhs->cycle;
return lhs->cycle < rhs->cycle;
}
void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,
@ -210,7 +210,8 @@ void nghttp2_stream_reschedule(nghttp2_stream *stream) {
DEBUGF(fprintf(stderr, "stream: stream=%d obq resched cycle=%ld\n",
stream->stream_id, stream->cycle));
nghttp2_pq_increase_key(&dep_stream->obq, &stream->pq_entry);
nghttp2_pq_remove(&dep_stream->obq, &stream->pq_entry);
nghttp2_pq_push(&dep_stream->obq, &stream->pq_entry);
dep_stream->last_writelen = stream->last_writelen;
}