Skip to content

Commit f3b7c3e

Browse files
add some debug logs
1 parent 8214efa commit f3b7c3e

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description = "cargo run for wasm programs"
1111

1212
[dependencies]
1313
anyhow = "1.0"
14-
tracing = "0.1"
14+
tracing = { version = "0.1", default-features = false, features = ["release_max_level_debug"] }
1515
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
1616

1717
wasm-bindgen-cli-support = "0.2"

src/wasm_bindgen.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use std::path::Path;
2-
3-
use anyhow::Context;
4-
51
use crate::Result;
2+
use anyhow::Context;
3+
use std::path::Path;
4+
use tracing::debug;
65

76
const COMPRESSION_LEVEL: u32 = 2;
87

@@ -11,16 +10,26 @@ pub struct WasmBindgenOutput {
1110
pub compressed_wasm: Vec<u8>,
1211
}
1312
pub fn generate(wasm_file: &Path) -> Result<WasmBindgenOutput> {
13+
debug!("running wasm-bindgen...");
14+
let start = std::time::Instant::now();
1415
let mut output = wasm_bindgen_cli_support::Bindgen::new()
1516
.input_path(wasm_file)
1617
.web(true)?
1718
.typescript(false)
1819
.generate_output()?;
20+
debug!("finished wasm-bindgen (took {:?})", start.elapsed());
1921

2022
let js = output.js().to_owned();
23+
24+
debug!("emitting wasm...");
25+
let start = std::time::Instant::now();
2126
let wasm = output.wasm_mut().emit_wasm();
27+
debug!("emitting wasm took {:?}", start.elapsed());
2228

29+
debug!("compressing wasm...");
30+
let start = std::time::Instant::now();
2331
let compressed_wasm = compress(&wasm).context("failed to compress wasm file")?;
32+
debug!("compressing took {:?}", start.elapsed());
2433

2534
Ok(WasmBindgenOutput { js, compressed_wasm })
2635
}

0 commit comments

Comments
 (0)