perf: reduce Expression size from 244B to 152B

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz 2020-10-07 12:20:49 +02:00
parent 39cd98d2c0
commit c8299743b8
2 changed files with 3 additions and 3 deletions

View File

@ -54,7 +54,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
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)?))

View File

@ -64,7 +64,7 @@ pub enum Expression {
Address(String, Span),
Boolean(String, Span),
Field(String, Span),
Group(GroupValue),
Group(Box<GroupValue>),
Implicit(String, Span),
Integer(IntegerType, String, Span),
@ -597,7 +597,7 @@ impl<'ast> From<FieldValue<'ast>> for Expression {
impl<'ast> From<AstGroupValue<'ast>> for Expression {
fn from(ast_group: AstGroupValue<'ast>) -> Self {
Expression::Group(GroupValue::from(ast_group))
Expression::Group(Box::new(GroupValue::from(ast_group)))
}
}