Skip to content

Commit

Permalink
Increase chunk size from 4KB to 16KB to fix performance issue. (#225)
Browse files Browse the repository at this point in the history
* Increase chunk size from 4KB to 16KB to fix performance issue.
  • Loading branch information
HuakunShen committed May 5, 2024
1 parent 6082d8b commit 420f152
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/core/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ pub async fn test_file_rust2rust_deprecated() -> eyre::Result<()> {
.name("sender".to_owned())
.spawn(async {
let (welcome, wormhole_future) =
Wormhole::connect_without_code(transfer::APP_CONFIG.id(TEST_APPID).clone(), 2).await?;
Wormhole::connect_without_code(transfer::APP_CONFIG.id(TEST_APPID).clone(), 2)
.await?;
if let Some(welcome) = &welcome.welcome {
log::info!("Got welcome: {}", welcome);
}
Expand Down Expand Up @@ -258,7 +259,8 @@ pub async fn test_file_rust2rust() -> eyre::Result<()> {
.name("sender".to_owned())
.spawn(async {
let mailbox_connection =
MailboxConnection::create(transfer::APP_CONFIG.id(TEST_APPID).clone(), 2).await?;
MailboxConnection::create(transfer::APP_CONFIG.id(TEST_APPID).clone(), 2)
.await?;
if let Some(welcome) = &mailbox_connection.welcome {
log::info!("Got welcome: {}", welcome);
}
Expand Down
3 changes: 1 addition & 2 deletions src/transfer/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,7 @@ pub async fn send_records<'a>(

let mut hasher = Sha256::default();

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

0 comments on commit 420f152

Please sign in to comment.