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

move to wasmer 3.1.1 #3367

Closed
wants to merge 5 commits into from
Closed

move to wasmer 3.1.1 #3367

wants to merge 5 commits into from

Conversation

pdogr
Copy link
Contributor

@pdogr pdogr commented Apr 20, 2023

#3241
cargo audit still complains about mach

Crate:     mach
Version:   0.3.2
Warning:   unmaintained
Title:     mach is unmaintained
Date:      2020-07-14
ID:        RUSTSEC-2020-0168
URL:       https://rustsec.org/advisories/RUSTSEC-2020-0168
Dependency tree:
mach 0.3.2
├── wasmer-vm 3.1.1
│   ├── wasmer-compiler 3.1.1
│   │   ├── wasmer-compiler-singlepass 3.1.1
│   │   │   └── wasmer 3.1.1
│   │   │       ├── wasmer-wasi-types 3.1.1
│   │   │       │   └── wasmer-wasi 3.1.1
│   │   │       │       └── icu_codepointtrie_builder 0.3.5
│   │   │       │           └── icu_datagen 1.2.0
│   │   │       │               ├── tutorials-test 0.0.0
│   │   │       │               └── icu_testdata_scripts 0.0.0
│   │   │       ├── wasmer-wasi 3.1.1
│   │   │       └── icu_codepointtrie_builder 0.3.5
│   │   └── wasmer 3.1.1
│   └── wasmer 3.1.1
└── region 3.0.0
    ├── wasmer-vm 3.1.1
    └── wasmer-compiler 3.1.1

@pdogr pdogr requested review from echeran and a team as code owners April 20, 2023 19:30
@pdogr pdogr requested a review from robertbastian April 20, 2023 19:30
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • Cargo.lock is different
  • components/collections/codepointtrie_builder/src/wasm.rs is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • Cargo.lock is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot


const WASM_BYTES: &[u8] = include_bytes!("../list_to_ucptrie.wasm");

lazy_static! {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: If you are not using lazy_static any more, please remove it from cargo.toml

Comment on lines +30 to +31
let mut store = Store::default();
let module = Module::new(&store, WASM_BYTES).expect("valid WASM");
Copy link
Member

Choose a reason for hiding this comment

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

Question: it seems like a regression that we need to parse the bytes to a module every time. Before we did it in the lazy_static, such that the first call was slow but every subsequent call was fast. It appears that Wasmer 3 requires the store to be mutable. I wonder why? It seems like we should still be able to create a Module just once and then an Instance for each call.

Copy link
Member

Choose a reason for hiding this comment

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

Actually does the store need to be the same for the Module and the Instance? Otherwise why would the API allow you to pass different arguments to both instead of just borrowing the store from the Module!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yes but those hello world examples don't need to re-use the module. We should be able to parse the module once and not be required to re-parse it on every function call, just as we were able to do in Wasmer 2.0.

CC @syrusakbary for potential advice on updating from wasmer 2 to wasmer 3.

Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

^

@pdogr
Copy link
Contributor Author

pdogr commented May 6, 2023

Some benches on Mac x86
Command run

cargo run --release --bin=icu4x-datagen --all-features -- --icuexport-root=../repodata/data/icuexport --syntax=postcard --out=/dev/null --format=blob --overwrite --keys=segmenter/word@1 --all-locales

This PR

INFO  [icu_datagen] Writing key: segmenter/word@1
INFO  [icu_provider_blob::export::blob_exporter] Serializing blob to output stream...

________________________________________________________
Executed in    2.84 secs    fish           external
   usr time    2.07 secs  260.00 micros    2.07 secs
   sys time    0.30 secs  995.00 micros    0.30 secs

HEAD @ 2f5c923

INFO  [icu_datagen] Writing key: segmenter/word@1
INFO  [icu_provider_blob::export::blob_exporter] Serializing blob to output stream...

________________________________________________________
Executed in    1.20 secs      fish           external
   usr time  968.95 millis  261.00 micros  968.68 millis
   sys time  440.98 millis  933.00 micros  440.05 millis

@sffc
Copy link
Member

sffc commented May 7, 2023

Make sure the bench is writing multiple keys that all use the WASM module. My thesis is that there's a perf regression when the module is being reused.

@robertbastian
Copy link
Member

Well there's a perf regressions even for a single key...

@robertbastian robertbastian added discuss-priority Discuss at the next ICU4X meeting and removed discuss-priority Discuss at the next ICU4X meeting labels May 11, 2023
@robertbastian
Copy link
Member

Discussion: we want to update to wasmer 3, but there shouldn't be a performance hit.

Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

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

.

@westy92
Copy link
Contributor

westy92 commented Aug 5, 2023

The latest versions are now:

  • wasmer 4.1.1
  • wasmer-wasix 0.11.0

Perhaps the performance has been improved?

@robertbastian robertbastian added the waiting-on-author PRs waiting for action from the author for >7 days label Feb 8, 2024
@robertbastian
Copy link
Member

#4621

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author PRs waiting for action from the author for >7 days
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants