Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
axetroy opened this issue May 14, 2023 · 2 comments
Open

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

axetroy opened this issue May 14, 2023 · 2 comments

Comments

@axetroy
Copy link

axetroy commented May 14, 2023

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 <[email protected]>"]
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
Copy link
Member

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

@axetroy
Copy link
Author

axetroy commented May 17, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants