Skip to content

Instantly share code, notes, and snippets.

View LevBeta's full-sized avatar
🎯
Focusing

Beta LevBeta

🎯
Focusing
  • At nvim probably
  • 09:17 (UTC +01:00)
  • X @levbeta
View GitHub Profile
// BENCH
const NEW_TEMPLATE_INPUT: &str = r#"{"e":"depthUpdate","E":1571889248277,"T":1571889248276,"s":"BTCUSDT","U":390497796,"u":390497878,"pu":390497794,"b":[["7403.89","0.002"],["7403.90","3.906"],["7404.00","1.428"],["7404.85","5.239"],["7405.43","2.562"]],"a":[["7405.96","3.340"],["7406.63","4.525"],["7407.08","2.475"],["7407.15","4.800"],["7407.20","0.175"]]}"#;
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("Deserialize using serde", |b| {
b.iter(|| {
let _: BBO =
serde_json::from_str(NEW_TEMPLATE_INPUT).expect("Failed to deserialize JSON");
})