File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ description = "cargo run for wasm programs"
1111
1212[dependencies ]
1313anyhow = " 1.0"
14- tracing = " 0.1"
14+ tracing = { version = " 0.1" , default-features = false , features = [ " release_max_level_debug " ] }
1515tracing-subscriber = { version = " 0.3" , features = [" env-filter" ] }
1616
1717wasm-bindgen-cli-support = " 0.2"
Original file line number Diff line number Diff line change 1- use std:: path:: Path ;
2-
3- use anyhow:: Context ;
4-
51use crate :: Result ;
2+ use anyhow:: Context ;
3+ use std:: path:: Path ;
4+ use tracing:: debug;
65
76const COMPRESSION_LEVEL : u32 = 2 ;
87
@@ -11,16 +10,26 @@ pub struct WasmBindgenOutput {
1110 pub compressed_wasm : Vec < u8 > ,
1211}
1312pub 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}
You can’t perform that action at this time.
0 commit comments