Skip to content

Commit 226a006

Browse files
committed
perf: increase NO_COPY_DATA_THRESHOLD to 128 KB for improved buffer handling
1 parent 343eedc commit 226a006

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/wkwebview/class/url_scheme_handler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use objc2_web_kit::{WKURLSchemeHandler, WKURLSchemeTask};
2626

2727
use crate::{wkwebview::WEBVIEW_STATE, RequestAsyncResponder, WryWebView};
2828

29-
const NO_COPY_DATA_THRESHOLD: usize = 64 * 1024;
29+
const NO_COPY_DATA_THRESHOLD: usize = 128 * 1024;
3030

3131
pub fn create(name: &str) -> &AnyClass {
3232
unsafe {
@@ -267,8 +267,8 @@ extern "C" fn start_task(
267267
.map_err(|_e| crate::Error::CustomProtocolTaskInvalid)?;
268268

269269
let content = sent_response.into_body();
270-
// It yields benefits by eliminating buffer copying starting from 64 KB.
271-
// However, sizes below 64 bytes cause regressions(or noise). 64 KB as
270+
// It yields benefits by eliminating buffer copying starting from 128 KB.
271+
// However, sizes below 64 bytes cause regressions(or noise). 128 KB as
272272
// it aligns better with engineering standards and is more human-readable.
273273
let data = if content_len < NO_COPY_DATA_THRESHOLD {
274274
// Keep small responses on the original copy path; no-copy deallocation costs more.

0 commit comments

Comments
 (0)