Skip to content

Commit

Permalink
chore(examples): remove wee_alloc from wasm-demo and ensure-no_std (#…
Browse files Browse the repository at this point in the history
…1337)

* Remove wee_alloc from wasm-demo

The allocator wasn't being used anyways (it was an optional dependency).
Also, using it results in a 1.2 MB size, compared to the original 1.1 MB.

* Remove wee_alloc from ensure-no_std

* Update changelog
  • Loading branch information
MegaRedHand committed Jul 18, 2023
1 parent e1bfb73 commit 2a1f732
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 54 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* chore(examples): remove _wee_alloc_ dependency from _wasm-demo_ example and _ensure-no_std_ dummy crate [#1337](https://github.com/lambdaclass/cairo-vm/pull/1337)

* docs: improved crate documentation [#1334](https://github.com/lambdaclass/cairo-vm/pull/1334)

* chore!: made `deserialize_utils` module private [#1334](https://github.com/lambdaclass/cairo-vm/pull/1334)
Expand Down
57 changes: 16 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ensure-no_std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cairo-felt = { path = "../felt", default-features = false, features = [
] }
cairo-vm = { path = "../vm", default-features = false }

wee_alloc = "0.4.5"
esp-alloc = "0.3.0"

[features]
default = ["lambdaworks-felt"]
Expand Down
3 changes: 2 additions & 1 deletion ensure-no_std/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ pub extern "C" fn _start() -> ! {
}

#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
// NOTE: this should be initialized before use
static ALLOC: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();

#[allow(unused_imports)]
use {cairo_felt, cairo_vm};
5 changes: 0 additions & 5 deletions examples/wasm-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ wasm-bindgen = "0.2.87"
# 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.
wee_alloc = { version = "0.4.5", optional = true }

cairo-vm = { workspace = true }

[dev-dependencies]
Expand Down
6 changes: 0 additions & 6 deletions examples/wasm-demo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ use cairo_vm::{
};
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]
extern "C" {
#[wasm_bindgen(js_namespace = console)]
Expand Down

1 comment on commit 2a1f732

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 2a1f732 Previous: e1bfb73 Ratio
parse program 23981937 ns/iter (± 1183606) 17651049 ns/iter (± 74319) 1.36

This comment was automatically generated by workflow using github-action-benchmark.

CC: @unbalancedparentheses

Please sign in to comment.