Remove wee_alloc and switch to default allocator
There has been reports that wee_alloc can cause memory leaks. Also, it is mostly unmaintained and the default wasm allocator is "good enough" in recent versions. I'm hoping this might aleviate some of the issues I was seeing with processing slowing to a crawl after re-using a worker too many times.
This commit is contained in:
parent
7a16a7d347
commit
ee0c33eaa8
@ -8,7 +8,7 @@ edition = "2018"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[features]
|
||||
default = ["console_error_panic_hook", "wee_alloc"]
|
||||
default = ["console_error_panic_hook"]
|
||||
|
||||
[dependencies]
|
||||
seahash = "4.1"
|
||||
@ -21,13 +21,6 @@ wasm-bindgen = { version = "0.2.63", features = ["serde-serialize"] }
|
||||
# code size when deploying.
|
||||
console_error_panic_hook = { version = "0.1.6", optional = true }
|
||||
|
||||
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
|
||||
# compared to the default allocator's ~10K. It is slower than the default
|
||||
# allocator, however.
|
||||
#
|
||||
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
|
||||
wee_alloc = { version = "0.4.5", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.13"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<h1><code>skyrim-cell-dump-wasm</code></h1>
|
||||
|
||||
<strong>Exports the <code>process_plugin</code> function from the <a href="https://github.com/thallada/skyrim-cell-dump">skyrim-cell-dump</a> Rust library in WebAssembly using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong>
|
||||
<strong>Exports the <code>parse_plugin</code> function from the <a href="https://github.com/thallada/skyrim-cell-dump">skyrim-cell-dump</a> Rust library in WebAssembly using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -4,12 +4,6 @@ use seahash;
|
||||
use skyrim_cell_dump;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
|
||||
// allocator.
|
||||
#[cfg(feature = "wee_alloc")]
|
||||
#[global_allocator]
|
||||
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_plugin(input: &[u8]) -> JsValue {
|
||||
JsValue::from_serde(&skyrim_cell_dump::parse_plugin(input).unwrap()).unwrap()
|
||||
|
Loading…
Reference in New Issue
Block a user