Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/hotfix-message/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ workspace = true
hotfix-derive = { version = "0.1.2", path = "../hotfix-derive" }
hotfix-dictionary = { version = "0.1.2", path = "../hotfix-dictionary" }

anyhow.workspace = true
chrono.workspace = true
indexmap.workspace = true
thiserror.workspace = true
Expand Down
14 changes: 7 additions & 7 deletions crates/hotfix-message/benches/message_parsing.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
use criterion::{Criterion, criterion_group, criterion_main};
use hotfix_dictionary::Dictionary;
use hotfix_message::message::{Config, Message};
use hotfix_message::MessageBuilder;
use hotfix_message::message::Config;
use std::hint::black_box;

const EXECUTION_REPORT_MESSAGE: &[u8] = b"8=FIX.4.4|9=247|35=8|34=2|49=Broker|52=20231103-09:30:00|56=Client|11=Order12345|17=Exec12345|150=0|39=0|55=APPL|54=1|38=100|32=50|31=150.00|151=50|14=50|6=150.00|453=2|448=PARTYA|447=D|452=1|802=2|523=SUBPARTYA1|803=1|523=SUBPARTYA2|803=2|448=PARTYB|447=D|452=2|10=129|";
const CONFIG: Config = Config::with_separator(b'|');

fn parse_message(dict: &Dictionary) {
let message = Message::from_bytes(&CONFIG, dict, black_box(EXECUTION_REPORT_MESSAGE))
.into_message()
.unwrap();
black_box(message);
fn parse_message(builder: &MessageBuilder) {
let parsed = builder.build(black_box(EXECUTION_REPORT_MESSAGE));
black_box(parsed);
}

fn message_parsing_benchmark(c: &mut Criterion) {
let dict = Dictionary::fix44();
let builder = MessageBuilder::new(dict.clone(), CONFIG).unwrap();
c.bench_function("parse message", |b| {
b.iter(|| parse_message(black_box(&dict)))
b.iter(|| parse_message(black_box(&builder)))
});
}

Expand Down
Loading