Skip to content

Simplify VisitOperator for VisitConstOperator#1912

Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:simplify-const-operator-visit
Nov 25, 2024
Merged

Simplify VisitOperator for VisitConstOperator#1912
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:simplify-const-operator-visit

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

Don't generate a format!-per-opcode but instead delegate to a single helper method.

Don't generate a `format!`-per-opcode but instead delegate to a single
helper method.
@alexcrichton alexcrichton added this pull request to the merge queue Nov 25, 2024
Merged via the queue into bytecodealliance:main with commit d9ca220 Nov 25, 2024
@alexcrichton alexcrichton deleted the simplify-const-operator-visit branch November 25, 2024 18:32
@Robbepop
Copy link
Copy Markdown
Collaborator

Robbepop commented Nov 28, 2024

@alexcrichton I just ran cargo bloat on the most recent Wasmi v0.40 version that uses the new wasmparser v0.221 and const-expr validator still is marked as bloated:

    Analyzing target/release/wasmi_cli

 File  .text    Size        Crate Name
 1.2%   2.1% 49.0KiB         wast <wast::core::expr::Instruction as wast::parser::Parse>::parse::{{closure}}
 1.0%   1.7% 38.8KiB   wasmparser wasmparser::validator::core::ModuleState::check_const_expr
 0.9%   1.5% 35.6KiB wasm_encoder <wasm_encoder::core::code::Instruction as wasm_encoder::Encode>::encode
 0.8%   1.4% 31.6KiB    wasmi_ir? <wasmi_ir::enum::Instruction as core::fmt::Debug>::fmt
 0.7%   1.3% 29.3KiB        wasmi wasmi::engine::translator::driver::FuncTranslationDriver<T>::translate_operators
 0.6%   1.1% 26.3KiB        wasmi wasmi::engine::executor::instrs::execute_instrs
 0.5%   1.0% 22.3KiB         wast wast::core::binary::encode
 0.5%   1.0% 22.2KiB    wasmi_cli wasmi_cli::context::Context::new
 0.5%   0.9% 21.5KiB        wasmi wasmi::module::parser::buffered::<impl wasmi::module::parser::ModuleParser>::parse_buffered_impl
 0.4%   0.7% 16.0KiB        wasmi wasmi::engine::translator::driver::FuncTranslationDriver<T>::translate_operators
 0.4%   0.7% 16.0KiB   wasmi_cli? <wasmi_cli::args::Args as clap_builder::derive::Args>::augment_args
 0.4%   0.7% 15.4KiB clap_builder clap_builder::derive::Parser::parse
 0.4%   0.7% 15.4KiB clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.4%   0.7% 15.3KiB          wat wat::Parser::_parse_str
 0.3%   0.6% 13.8KiB clap_builder clap_builder::parser::validator::Validator::validate
 0.3%   0.6% 13.2KiB         wast <wast::core::custom::Custom as wast::parser::Parse>::parse
 0.3%   0.5% 12.5KiB        wasmi wasmi::engine::translator::driver::FuncTranslationDriver<T>::translate_operators
 0.3%   0.5% 12.2KiB  wasmparser? <wasmparser::readers::core::operators::Operator as core::fmt::Debug>::fmt
 0.3%   0.5% 11.3KiB         wast wast::core::module::ModuleField::parse_remaining
 0.2%   0.4% 10.2KiB        wasmi wasmi::engine::translator::driver::FuncTranslationDriver<T>::translate_operators
46.7%  81.8%  1.9MiB              And 5298 smaller methods. Use -n N to show more.
57.1% 100.0%  2.3MiB              .text section size, the file size is 4.0MiB

Though it could be that multiple different wasmparser versions are at play.
However, cargo tree -p wasmi_cli | grep 'wasmparser' reveals only one:

│   └── wasmparser v0.221.0

@alexcrichton
Copy link
Copy Markdown
Member Author

Ah yeah I'd probably try to get the old wasmparser pruned first to confirm it's not coming from there. If it's still here though happy to help dig in

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

Successfully merging this pull request may close these issues.

2 participants