use criterion::{criterion_group, criterion_main, Criterion};
use serde::{Deserialize, Serialize};
const XML: &'static str = r#"
"#;
#[derive(Clone, Deserialize, Serialize)]
pub struct Types {
#[serde(rename = "@xmlns")]
pub xmlns: Option,
#[serde(skip)]
pub xmlns_map: std::collections::HashMap,
#[serde(rename = "@Ignorable")]
pub mc_ignorable: Option,
#[serde(rename = "$value")]
pub children: Vec,
}
#[derive(Clone, Deserialize, Serialize)]
pub enum TypesChildChoice {
Default(std::boxed::Box),
Override(std::boxed::Box),
}
#[derive(Clone, Deserialize, Serialize)]
pub struct Default {
#[serde(rename = "@Extension")]
pub extension: String,
#[serde(rename = "@ContentType")]
pub content_type: String,
}
#[derive(Clone, Deserialize, Serialize)]
pub struct Override {
#[serde(rename = "@ContentType")]
pub content_type: String,
#[serde(rename = "@PartName")]
pub part_name: String,
}
fn from_str() {
let _ = ooxmlsdk_build::includes::packages::opc_content_types::Types::from_str(XML).unwrap();
}
fn serde_from_str() {
let _: Types = quick_xml::de::from_str(XML).unwrap();
}
fn bench_from_str(c: &mut Criterion) {
c.bench_function("from_str", |b| b.iter(|| from_str()));
}
fn bench_serde_from_str(c: &mut Criterion) {
c.bench_function("serde_from_str", |b| b.iter(|| serde_from_str()));
}
criterion_group!(benches, bench_from_str, bench_serde_from_str);
criterion_main!(benches);