Skip to content

Commit

Permalink
Fix more
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Mar 24, 2023
1 parent 61940d6 commit 2a1cd12
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/swc_common/benches/serde.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "serde-impl"), allow(unused))]

use ast_node::ast_node;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -64,6 +66,7 @@ fn bench_serde(c: &mut Criterion) {
}

fn bench_ast_node(c: &mut Criterion) {
#[cfg(feature = "serde-impl")]
c.bench_function("serialization of ast node", |b| {
let src = AstNode::String(Str {
span: DUMMY_SP,
Expand All @@ -72,6 +75,7 @@ fn bench_ast_node(c: &mut Criterion) {

b.iter(|| black_box(serde_json::to_string(&src).unwrap()));
});
#[cfg(feature = "serde-impl")]
c.bench_function("deserialization of ast node", |b| {
let src = serde_json::to_string(&AstNode::String(Str {
span: DUMMY_SP,
Expand Down

0 comments on commit 2a1cd12

Please sign in to comment.