old-storyai / tracing-wasm

`tracing` crate compatible `Subscriber` for reporting spans through browser `window.performance`
Apache License 2.0
69 stars 22 forks source link

This crate will increase the size of wasm by about 100KB #25

Open axetroy opened 1 year ago

axetroy commented 1 year ago

My whole program is 33 KB after compilation, but after adding this crate, it becomes 130 KB

before

-rw-r--r--  1 axetroy  staff    33K  5 14 16:31 wasm_hasher_sha1_bg.wasm

after

-rw-r--r--  1 axetroy  staff   128K  5 14 16:34 wasm_hasher_sha1_bg.wasm

I think it is acceptable to increase within 10KB, but why increase so much

Here is my Cargo.toml

[package]
name = "wasm-hasher-sha1"
version = "0.1.2"
authors = ["Axetroy <axetroy.dev@gmail.com>"]
edition = "2021"
repository = "https://github.com/axetroy/wasm-hasher"
readme = "README.md"
description = "computed data hash by webAssembly"
license = "Anti-996"
keywords = ["sha1", "wasm", "webassembly"]

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = ["start", "wee_alloc"]
start = ["console_error_panic_hook", "tracing-wasm"]

[dependencies]
console_error_panic_hook = { version = "0.1.7", optional = true}
tracing-wasm = { version = "0.2.1", optional = true }
# The `wasm-bindgen` crate provides the bare minimum functionality needed
# to interact with JavaScript.
wasm-bindgen = "0.2.85"
sha1 = "0.10.5"
js-sys = "0.3.62"
digest = "0.10.6"
wasm-bindgen-futures = "0.4.35"
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. However, it is slower than the default
# allocator, so it's not enabled by default.
wee_alloc = { version = "0.4.2", optional = true }
wasm-hasher-lib = { path = "../lib" }

# The `web-sys` crate allows you to interact with the various browser APIs,
# like the DOM.
[dependencies.web-sys]
version = "0.3.61"
features = ["console", "FileReader", "Blob", "AbortSignal"]

# These crates are used for running unit tests.
[dev-dependencies]
wasm-bindgen-test = "0.2.45"
futures = "0.1.27"
js-sys = "0.3.62"
colelawrence commented 5 months ago

@axetroy - Did you have any other discoveries about what was going on here? I'm personally unsure how I can debug this issue.

axetroy commented 5 months ago

@axetroy - Did you have any other discoveries about what was going on here? I'm personally unsure how I can debug this issue.

Sorry, I can't help you with this, I don't know much about it