-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debug heatmap, data processor, benchmarking
- Loading branch information
1 parent
a50d357
commit 70ede93
Showing
3 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "cbor_decoder" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[dependencies] | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_cbor = "0.11" | ||
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] } | ||
serde-wasm-bindgen = "0.6.5" | ||
|
||
|
||
[profile.release] | ||
opt-level = "z" # Optimize for size (can be adjusted to 3 for speed) | ||
lto = true # Enable Link-Time Optimization | ||
codegen-units = 1 # Single codegen unit improves optimizations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use wasm_bindgen::prelude::*; | ||
use serde_cbor::Value; | ||
use serde_wasm_bindgen::to_value; | ||
|
||
#[wasm_bindgen] | ||
pub fn decode_cbor(data: &[u8]) -> JsValue { | ||
match serde_cbor::from_slice::<Value>(data) { | ||
Ok(value) => to_value(&value).unwrap_or(JsValue::NULL), | ||
Err(_) => JsValue::NULL, | ||
} | ||
} | ||
|