diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-09-14 07:10:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 10:10:31 -0400 |
commit | cdc69da9e5556375583730743a55c7ab7985e953 (patch) | |
tree | 1d328f4183f570637499a98385389e9aca1dccbd /yjit/src/backend/ir.rs | |
parent | 1b6d2b91843cdd07d5dbc8cfd6354a83f06daf8c (diff) | |
download | ruby-cdc69da9e5556375583730743a55c7ab7985e953.tar.gz |
YJIT: Initialize Assembler vectors with capacity (#8437)
Diffstat (limited to 'yjit/src/backend/ir.rs')
-rw-r--r-- | yjit/src/backend/ir.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/yjit/src/backend/ir.rs b/yjit/src/backend/ir.rs index a6803f7a63..5f69f5a01f 100644 --- a/yjit/src/backend/ir.rs +++ b/yjit/src/backend/ir.rs @@ -983,6 +983,9 @@ impl SideExitContext { } } +/// Initial capacity for asm.insns vector +const ASSEMBLER_INSNS_CAPACITY: usize = 256; + /// Object into which we assemble instructions to be /// optimized and lowered pub struct Assembler { @@ -1016,8 +1019,8 @@ impl Assembler pub fn new_with_label_names(label_names: Vec<String>, side_exits: HashMap<SideExitContext, CodePtr>) -> Self { Self { - insns: Vec::default(), - live_ranges: Vec::default(), + insns: Vec::with_capacity(ASSEMBLER_INSNS_CAPACITY), + live_ranges: Vec::with_capacity(ASSEMBLER_INSNS_CAPACITY), label_names, ctx: Context::default(), side_exits, |