Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Possible huge setarrvalue optimization



Sebastian Gniazdowski wrote on Wed, Jan 04, 2017 at 13:31:52 -0500:
> You then wrote:
> 
> "Should this line check that «v->pm->gsu.a.setfn == arrsetfn»?
> 
> Should this line check that «pm->ename == NULL» [since arrsetfn()
> handles such arrays specially]?"
> 
> I think both propositions are good, especially the ename check

I've incorporated them when I pushed (4fb4ce190ccb).

> – activated when parameter is being automatically exported – if I understand correctly. You could fix this by including code activated in the normal setter when ename is not null – like Peter did with string optimization. This way auto-exported arrays will still be optimized.

[Peter's change to which you refer is 39995.]

Thanks for the suggestion.  I agree the pm->ename != NULL case could be
optimised further, however, I don't intend to look into that myself.

Here's also an addendum to 39995.

diff --git a/Src/params.c b/Src/params.c
index c64d748..fc313cd 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3458,6 +3458,8 @@ strsetfn(Param pm, char *x)
 	pm->node.flags |= PM_NAMEDDIR;
 	adduserdir(pm->node.nam, x, 0, 0);
     }
+    /* If you update this function, you may need to update the
+     * `Implement remainder of strsetfn' block in assignstrvalue(). */
 }
 
 /* Function to get value of an array parameter */

Thanks again for the review.

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author