From da63a43f7ce765752b9efabc1f0d5cd000501abd Mon Sep 17 00:00:00 2001 From: Zhang Junyu Date: Tue, 28 May 2024 06:18:05 +0000 Subject: [PATCH] perf: optimize memory_table --- crates/specs/src/slice.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/specs/src/slice.rs b/crates/specs/src/slice.rs index 27d67ccd5..6b56ef667 100644 --- a/crates/specs/src/slice.rs +++ b/crates/specs/src/slice.rs @@ -4,6 +4,7 @@ use std::sync::Arc; use num_bigint::BigUint; use rayon::iter::IntoParallelRefIterator; use rayon::iter::ParallelIterator; +use rayon::prelude::ParallelSliceMut; use crate::brtable::BrTable; use crate::brtable::ElemTable; @@ -110,7 +111,7 @@ impl Slice { memory_entries.append(&mut set.into_iter().collect()); - memory_entries.sort_unstable_by_key(|item| (item.ltype, item.offset, item.eid)); + memory_entries.par_sort_unstable_by_key(|item| (item.ltype, item.offset, item.eid)); MTable::new(memory_entries) }