The following patch improves the performace of reading a 10k line file using
io∆readfile from several minutes down to about half a second.
The key to this was to avoid cloning the result when reading the value from a variable. This caused functions with lots of variable dereferencing to become incredibly slow. This should be safe as the values are cloned before modification anyway.
The same patch also marks the result of ⎕UCS as temp before returning the value since it's not changed further after returning the value.
Finally, Value::clone() is changed such that it doesn't actually perform any copying if the value is temp, and instead only marks the value non-temp. This is the right thing to do since any caller of clone() presumably wants to have exclusive ownership of the value.
Regards,
Elias