From 834fc9d09eb0ae433b2c1d02f2f18d8df33d8b08 Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Tue, 30 Jun 2026 21:49:41 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5=E6=B6=88=E9=99=A4=E5=86=97=E4=BD=99=E6=8B=B7=E8=B4=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_vm/src/dispatch/arithmetic.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/oxide_vm/src/dispatch/arithmetic.rs b/crates/oxide_vm/src/dispatch/arithmetic.rs index 0c97e81c..c3d60a9c 100644 --- a/crates/oxide_vm/src/dispatch/arithmetic.rs +++ b/crates/oxide_vm/src/dispatch/arithmetic.rs @@ -20,8 +20,9 @@ impl Vm { buf.clear(); coercion::push_to_string(lhs, &mut buf); coercion::push_to_string(rhs, &mut buf); - self.regs[rd] = self.new_string(&buf); - self.string_buf = buf; + let result = self.new_string_owned(buf); + self.string_buf = String::new(); + self.regs[rd] = result; } else { let ln = coercion::to_number(lhs); let rn = coercion::to_number(rhs); @@ -61,8 +62,9 @@ impl Vm { buf.clear(); coercion::push_to_string(lhs, &mut buf); coercion::push_to_string(rhs, &mut buf); - self.regs[rd] = self.new_string(&buf); - self.string_buf = buf; + let result = self.new_string_owned(buf); + self.string_buf = String::new(); + self.regs[rd] = result; } else { let ln = coercion::to_number(lhs); let rn = coercion::to_number(rhs);