From c8299743b8c2eadad79838aef3bd7f2f80a0a981 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Wed, 7 Oct 2020 12:20:49 +0200 Subject: [PATCH] perf: reduce Expression size from 244B to 152B Signed-off-by: ljedrz --- compiler/src/expression/expression.rs | 2 +- typed/src/expression.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/src/expression/expression.rs b/compiler/src/expression/expression.rs index 3304c2725d..d79416fd4d 100644 --- a/compiler/src/expression/expression.rs +++ b/compiler/src/expression/expression.rs @@ -54,7 +54,7 @@ impl> ConstrainedProgram { Expression::Address(address, span) => Ok(ConstrainedValue::Address(Address::constant(address, span)?)), Expression::Boolean(boolean, span) => Ok(ConstrainedValue::Boolean(new_bool_constant(boolean, span)?)), Expression::Field(field, span) => Ok(ConstrainedValue::Field(FieldType::constant(field, span)?)), - Expression::Group(group_element) => Ok(ConstrainedValue::Group(G::constant(group_element)?)), + Expression::Group(group_element) => Ok(ConstrainedValue::Group(G::constant(*group_element)?)), Expression::Implicit(value, span) => Ok(enforce_number_implicit(expected_type, value, span)?), Expression::Integer(type_, integer, span) => { Ok(ConstrainedValue::Integer(Integer::new_constant(&type_, integer, span)?)) diff --git a/typed/src/expression.rs b/typed/src/expression.rs index 5fc2543c1a..cb6132bd8b 100644 --- a/typed/src/expression.rs +++ b/typed/src/expression.rs @@ -64,7 +64,7 @@ pub enum Expression { Address(String, Span), Boolean(String, Span), Field(String, Span), - Group(GroupValue), + Group(Box), Implicit(String, Span), Integer(IntegerType, String, Span), @@ -597,7 +597,7 @@ impl<'ast> From> for Expression { impl<'ast> From> for Expression { fn from(ast_group: AstGroupValue<'ast>) -> Self { - Expression::Group(GroupValue::from(ast_group)) + Expression::Group(Box::new(GroupValue::from(ast_group))) } }