diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2026-08-17 20:07:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-17 20:07:51 +0200 |
| commit | 358a183e5c12c32b8836acf9c71799f56e00b036 (patch) | |
| tree | ffe63de847cebf5935951454eb8d76d9c76c222a /crates/parser/src/parallel.rs | |
| parent | a42cb3434bd79accb6a49298f498e016e9c93b9e (diff) | |
chore: reduce instruction enum size (#52)
this is a fairly big commit since I've been just playing around with
this
for a while now. the main goal is to reduce instruction size by moving
some operands into two separate vecs. memory operations still seem like
the biggest issue right now, so as a follow op I'll probably remove the
public linear memory trait again but let's see how this goes first.
performance wise this is about the same as before, but
serialization/deserialization
is about 20% faster now.
Signed-off-by: Henry <mail@henrygressmann.de>
---------
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/src/parallel.rs')
| -rw-r--r-- | crates/parser/src/parallel.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/parser/src/parallel.rs b/crates/parser/src/parallel.rs index e0e3858..e29b38f 100644 --- a/crates/parser/src/parallel.rs +++ b/crates/parser/src/parallel.rs @@ -1,4 +1,4 @@ -use crate::module::{FunctionCode, optimize_function_code}; +use crate::module::{OptimizedFunctionCode, optimize_function_code}; use crate::validation::{FuncToValidate, FuncValidatorAllocations, ValidatorResources}; use crate::{ParseError, ParserOptions, Result, conversion}; use alloc::sync::Arc; @@ -64,7 +64,7 @@ fn process_function_job( imported_memory_count: u32, validator_allocs: Option<FuncValidatorAllocations>, reader_allocs: OperatorsReaderAllocations, -) -> Result<(FunctionCode, Option<FuncValidatorAllocations>, OperatorsReaderAllocations)> { +) -> Result<(OptimizedFunctionCode, Option<FuncValidatorAllocations>, OperatorsReaderAllocations)> { #[cfg(feature = "validate")] let validator = job.func_to_validate.map(|func| func.into_validator(validator_allocs.unwrap_or_default())); #[cfg(not(feature = "validate"))] @@ -74,12 +74,12 @@ fn process_function_job( }; let (code, validator_allocs, reader_allocs) = match job.body { FunctionBodyInput::Borrowed(func) => { - conversion::convert_module_code(func, validator, reader_allocs, metadata, job.ty_idx)? + conversion::convert_module_code(func, validator, reader_allocs, metadata, job.ty_idx, options)? } FunctionBodyInput::Owned(body) => { let reader = wasmparser::BinaryReader::new(&body.section_bytes[body.body_range], body.body_offset); let func = wasmparser::FunctionBody::new(reader); - conversion::convert_module_code(func, validator, reader_allocs, metadata, job.ty_idx)? + conversion::convert_module_code(func, validator, reader_allocs, metadata, job.ty_idx, options)? } }; @@ -100,7 +100,7 @@ fn process_chunk<'a>( options: &ParserOptions, imported_func_count: usize, imported_memory_count: u32, -) -> Result<Vec<FunctionCode>> { +) -> Result<Vec<OptimizedFunctionCode>> { let mut validator_allocs = None; let mut reader_allocs = OperatorsReaderAllocations::default(); let jobs = jobs.into_iter(); @@ -130,7 +130,7 @@ pub(crate) fn process_pending( options: &ParserOptions, imported_func_count: usize, imported_memory_count: u32, -) -> Result<Vec<FunctionCode>> { +) -> Result<Vec<OptimizedFunctionCode>> { let num_workers = worker_count(options, pending.len()); if num_workers == 1 { return process_chunk(pending, metadata, options, imported_func_count, imported_memory_count); |
