diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-07-20 07:30:17 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 07:30:17 -0600 |
commit | bf775e3306faeb2a18525ba38f9c3e60e1e5ed16 (patch) | |
tree | 9c2ec1c7b50d079abfed3bd8deab2f0f11aff8c7 /ext/http/http_next.rs | |
parent | 1ee6218e488b277eeb5b80f87dbea97ebaf5dcb2 (diff) |
refactor(ext/http): Use const thread-local initializer for slightly better perf (#19881)
Benchmarking shows numbers are pretty close, however this is recommended
for the best possible thread-local performance and may improve in future
Rust compiler revisions.
Diffstat (limited to 'ext/http/http_next.rs')
-rw-r--r-- | ext/http/http_next.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs index e95839005..5635fbd4b 100644 --- a/ext/http/http_next.rs +++ b/ext/http/http_next.rs @@ -12,6 +12,7 @@ use crate::response_body::ResponseBytesInner; use crate::response_body::V8StreamHttpResponseBody; use crate::slab::slab_drop; use crate::slab::slab_get; +use crate::slab::slab_init; use crate::slab::slab_insert; use crate::slab::SlabId; use crate::websocket_upgrade::WebSocketUpgrade; @@ -836,6 +837,8 @@ pub fn op_http_serve<HTTP>( where HTTP: HttpPropertyExtractor, { + slab_init(); + let listener = HTTP::get_listener_for_rid(&mut state.borrow_mut(), listener_rid)?; @@ -886,6 +889,8 @@ pub fn op_http_serve_on<HTTP>( where HTTP: HttpPropertyExtractor, { + slab_init(); + let connection = HTTP::get_connection_for_rid(&mut state.borrow_mut(), connection_rid)?; |