You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since sharing has been introduced there is no measureable performance
benefit when using move_to_operands compared to copying:
for(int i=0; i<2000000; i++)
{
irep_idt id;
symbol_exprt s(id, bool_typet());
exprt something;
something.move_to_operands(s);
//something.copy_to_operands(s);
}
with move_to_operands: 0.59s
with copy_to_operands: 0.55s
This does not appear to require a recent compiler. Thus, there is no reason
to believe that moving ireps would be any faster than copying. Moving has
the additional disadvantage that there is a side-effect on the object that
is moved.
A scenario in which moving offers a benefit is the idiom in which
1) an irep x is copied,
2) the copy is then subsequently modified,
3) x is then destroyed.
The proposal is to do step 1) via an rvalue reference and std::move()
instead.
0 commit comments