From da73f90423496760d43244a9921645a85ed78344 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Wed, 16 Mar 2022 11:31:59 +0100 Subject: [PATCH] Benchmark more "boring" emails, not ones from the test-data dir --- benches/receive_emails.rs | 54 +++++++++++++----------- deltachat-test-messages/src/lib.rs | 66 ------------------------------ 2 files changed, 31 insertions(+), 89 deletions(-) delete mode 100644 deltachat-test-messages/src/lib.rs diff --git a/benches/receive_emails.rs b/benches/receive_emails.rs index 32e4f4734..249f3bdc0 100644 --- a/benches/receive_emails.rs +++ b/benches/receive_emails.rs @@ -30,29 +30,37 @@ async fn recv_emails(context: Context, emails: &[&[u8]]) -> Context { async fn recv_all_emails(mut context: Context, needs_move_enabled: bool) -> Context { context.disable_needs_move = !needs_move_enabled; - let emails = [ - include_bytes!("../test-data/message/allinkl-quote.eml").as_ref(), - include_bytes!("../test-data/message/apple_cid_jpg.eml").as_ref(), - include_bytes!("../test-data/message/attach_filename_encoded_words_windows1251.eml") - .as_ref(), - include_bytes!("../test-data/message/attach_filename_simple.eml").as_ref(), - include_bytes!("../test-data/message/AutocryptSetupMessage.eml").as_ref(), - include_bytes!("../test-data/message/blockquote-tag.eml").as_ref(), - include_bytes!("../test-data/message/cp1252-html.eml").as_ref(), - include_bytes!("../test-data/message/gmail_ndn.eml").as_ref(), - include_bytes!("../test-data/message/gmx-quote.eml").as_ref(), - include_bytes!("../test-data/message/mail_attach_txt.eml").as_ref(), - include_bytes!("../test-data/message/mailinglist_xt_local_spiegel.eml").as_ref(), - include_bytes!("../test-data/message/mail_with_user_and_group_avatars.eml").as_ref(), - include_bytes!("../test-data/message/pdf_filename_continuation.eml").as_ref(), - include_bytes!("../test-data/message/protonmail-repaired.eml").as_ref(), - include_bytes!("../test-data/message/subj_with_multimedia_msg.eml").as_ref(), - include_bytes!("../test-data/message/text_alt_plain_html.eml").as_ref(), - include_bytes!("../test-data/message/text_html.eml").as_ref(), - include_bytes!("../test-data/message/videochat_invitation.eml").as_ref(), - include_bytes!("../test-data/message/wrong-html.eml").as_ref(), - ]; - recv_emails(context, &emails).await + + for i in 0..100 { + let imf_raw = format!( + "Subject: Benchmark +Message-ID: Mr.OssSYnOFkhR.{i}@testrun.org +Date: Sat, 07 Dec 2019 19:00:27 +0000 +To: alice@example.com +From: sender@testrun.org +Chat-Version: 1.0 +Chat-Disposition-Notification-To: sender@testrun.org +Chat-User-Avatar: 0 +In-Reply-To: Mr.OssSYnOFkhR.{i_dec}@testrun.org +MIME-Version: 1.0 + +Content-Type: text/plain; charset=utf-8; format=flowed; delsp=no + +Hello {i}", + i = i, + i_dec = i - 1, + ); + dc_receive_imf( + &context, + imf_raw.as_bytes(), + "INBOX", + black_box(i.try_into().unwrap()), + false, + ) + .await + .unwrap(); + } + context } async fn create_context() -> Context { diff --git a/deltachat-test-messages/src/lib.rs b/deltachat-test-messages/src/lib.rs deleted file mode 100644 index 0b01d719e..000000000 --- a/deltachat-test-messages/src/lib.rs +++ /dev/null @@ -1,66 +0,0 @@ -use once_cell::sync::Lazy; - -pub static ALL_TEST_MESSAGES: Lazy<[&[u8]; 56]> = Lazy::new(|| { - [ - include_bytes!("../../test-data/message/allinkl-quote.eml").as_ref(), - include_bytes!("../../test-data/message/apple_cid_jpg.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_apostrophed_cont.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_apostrophed_cp1252.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_apostrophed.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_apostrophed_invalid.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_apostrophed_windows1251.eml") - .as_ref(), - include_bytes!("../../test-data/message/attach_filename_combined.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_encoded_words_bad_delimiter.eml") - .as_ref(), - include_bytes!("../../test-data/message/attach_filename_encoded_words_binary.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_encoded_words_cont.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_encoded_words.eml").as_ref(), - include_bytes!("../../test-data/message/attach_filename_encoded_words_windows1251.eml") - .as_ref(), - include_bytes!("../../test-data/message/attach_filename_simple.eml").as_ref(), - include_bytes!("../../test-data/message/AutocryptSetupMessage.eml").as_ref(), - include_bytes!("../../test-data/message/blockquote-tag.eml").as_ref(), - include_bytes!("../../test-data/message/cp1252-html.eml").as_ref(), - include_bytes!("../../test-data/message/gmail_ndn.eml").as_ref(), - include_bytes!("../../test-data/message/gmail_ndn_group.eml").as_ref(), - include_bytes!("../../test-data/message/gmx-forward.eml").as_ref(), - include_bytes!("../../test-data/message/gmx_ndn.eml").as_ref(), - include_bytes!("../../test-data/message/gmx-quote-body.eml").as_ref(), - include_bytes!("../../test-data/message/gmx-quote.eml").as_ref(), - include_bytes!("../../test-data/message/mail_attach_txt.eml").as_ref(), - include_bytes!("../../test-data/message/mailinglist_dhl.eml").as_ref(), - include_bytes!("../../test-data/message/mailinglist_dpd.eml").as_ref(), - include_bytes!("../../test-data/message/mailinglist_ttline.eml").as_ref(), - include_bytes!("../../test-data/message/mailinglist_with_mimepart_footer.eml").as_ref(), - include_bytes!("../../test-data/message/mailinglist_with_mimepart_footer_signed.eml") - .as_ref(), - include_bytes!("../../test-data/message/mailinglist_xing.eml").as_ref(), - include_bytes!("../../test-data/message/mailinglist_xt_local_microsoft.eml").as_ref(), - include_bytes!("../../test-data/message/mailinglist_xt_local_spiegel.eml").as_ref(), - include_bytes!("../../test-data/message/mail_with_user_and_group_avatars.eml").as_ref(), - include_bytes!("../../test-data/message/mail_with_user_avatar_deleted.eml").as_ref(), - include_bytes!("../../test-data/message/mail_with_user_avatar.eml").as_ref(), - include_bytes!("../../test-data/message/many_images_amazon_via_apple_mail.eml").as_ref(), - include_bytes!("../../test-data/message/pdf_filename_continuation.eml").as_ref(), - include_bytes!("../../test-data/message/pdf_filename_simple.eml").as_ref(), - include_bytes!("../../test-data/message/posteo_ndn.eml").as_ref(), - include_bytes!("../../test-data/message/protonmail-mixed-up.eml").as_ref(), - include_bytes!("../../test-data/message/protonmail-repaired.eml").as_ref(), - include_bytes!("../../test-data/message/quote_attach.eml").as_ref(), - include_bytes!("../../test-data/message/subj_with_multimedia_msg.eml").as_ref(), - include_bytes!("../../test-data/message/testrun_ndn_2.eml").as_ref(), - include_bytes!("../../test-data/message/testrun_ndn.eml").as_ref(), - include_bytes!("../../test-data/message/text_alt_html.eml").as_ref(), - include_bytes!("../../test-data/message/text_alt_plain.eml").as_ref(), - include_bytes!("../../test-data/message/text_alt_plain_html.eml").as_ref(), - include_bytes!("../../test-data/message/text_html.eml").as_ref(), - include_bytes!("../../test-data/message/text_plain_flowed.eml").as_ref(), - include_bytes!("../../test-data/message/text_plain_iso88591.eml").as_ref(), - include_bytes!("../../test-data/message/text_plain_unspecified.eml").as_ref(), - include_bytes!("../../test-data/message/tiscali_ndn.eml").as_ref(), - include_bytes!("../../test-data/message/videochat_invitation.eml").as_ref(), - include_bytes!("../../test-data/message/yahoo_ndn.eml").as_ref(), - include_bytes!("../../test-data/message/wrong-html.eml").as_ref(), - ] -});