Skip to content

__optimize_subsasgn_calls__

builtin · libnexusinterp/nexus-value/ov-usr-fcn-proprietary.cc

: val = __optimize_subsasgn_calls__ ()
: old_val = __optimize_subsasgn_calls__ (new_val)
: old_val = __optimize_subsasgn_calls__ (new_val, "local")

Read or change the interpreter flag that controls subsasgn call optimization.

With no argument the current flag value is returned. Supplying new_val sets the flag and returns the value it held beforehand. While the flag is on, the interpreter avoids a redundant copy of the object when dispatching to the subsasgn method of a user-defined class, so the method can update the value in place.

Invoked inside a function with a trailing "local" argument, the new setting applies only to that function and anything it calls, and the previous setting is reinstated automatically when the function returns.