From 66144929eb32a380d2738437e4ad665025835173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=B1=E7=89=B9=E6=AF=8F=E7=BE=8A=E9=98=9F?= 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 0c97e81..c3d60a9 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);