Skip to content

Commit 420f152

Browse files
authored
Increase chunk size from 4KB to 16KB to fix performance issue. (#225)
* Increase chunk size from 4KB to 16KB to fix performance issue.
1 parent 6082d8b commit 420f152

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/core/test.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ pub async fn test_file_rust2rust_deprecated() -> eyre::Result<()> {
183183
.name("sender".to_owned())
184184
.spawn(async {
185185
let (welcome, wormhole_future) =
186-
Wormhole::connect_without_code(transfer::APP_CONFIG.id(TEST_APPID).clone(), 2).await?;
186+
Wormhole::connect_without_code(transfer::APP_CONFIG.id(TEST_APPID).clone(), 2)
187+
.await?;
187188
if let Some(welcome) = &welcome.welcome {
188189
log::info!("Got welcome: {}", welcome);
189190
}
@@ -258,7 +259,8 @@ pub async fn test_file_rust2rust() -> eyre::Result<()> {
258259
.name("sender".to_owned())
259260
.spawn(async {
260261
let mailbox_connection =
261-
MailboxConnection::create(transfer::APP_CONFIG.id(TEST_APPID).clone(), 2).await?;
262+
MailboxConnection::create(transfer::APP_CONFIG.id(TEST_APPID).clone(), 2)
263+
.await?;
262264
if let Some(welcome) = &mailbox_connection.welcome {
263265
log::info!("Got welcome: {}", welcome);
264266
}

src/transfer/v1.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,7 @@ pub async fn send_records<'a>(
581581

582582
let mut hasher = Sha256::default();
583583

584-
// Yeah, maybe don't allocate 4kiB on the stack…
585-
let mut plaintext = Box::new([0u8; 4096]);
584+
let mut plaintext = vec![0u8; 16 * 1024].into_boxed_slice();
586585
let mut sent_size = 0;
587586
futures::pin_mut!(files);
588587
while let Some(mut file) = files.next().await.transpose()? {

0 commit comments

Comments
 (0)