chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] Argvector handling - maybe we could do better at t


From: Jörg F . Wittenberger
Subject: Re: [Chicken-hackers] Argvector handling - maybe we could do better at that
Date: Fri, 19 Feb 2016 11:35:01 +0100
User-agent: Mozilla/5.0 (X11; Linux armv7l; rv:38.0) Gecko/20100101 Icedove/38.4.0

Am 17.02.2016 um 17:36 schrieb Jörg F. Wittenberger:
> Am 17.02.2016 um 13:22 schrieb Jörg F. Wittenberger:
>> Am 16.02.2016 um 22:54 schrieb Peter Bex:
>>> How about the stack-allocated vector I proposed?  It'd also be the
>>> smallest change from what we currently have, I think.

The past days I've tried a few modifications towards this end.

Short story: there is something to gain.  But little it is.  In the 5%
range when modifying hash tables and almost 10% more when modifying a
binary tree.  Lookups gain nothing so far.

Long story: I failed on the next logical step and need help.

So far I maintain _two_ more globals, the currently re-usable argvector
and it's allocated length.

Initially I only checked the required argvector length (the "avl" value
in c-backend.scm) against the allocated length (in the hope that the
compiler might catch more cases where the "c" parameter is unused except
for the av-reuse test and optimize that away) and returned the reusable
av upon success.  However it turned out that checking against the actual
arg count "c" first and the global only if that fails was consistently
faster.  Easy to understand in a way, cache locality I'd guess.

So better the other way around: get rid of the globals.

One thing I did not yet try: maybe it's beneficial to have a version of
C_kontinue which receives the current av, its size and the c argument to
enable av-reuse without accessing those globals.

What tried was a length-prefixed av.  Just C_alloc one more word, stick
the length in and return av+1.  Thus getting rid of the global size.

Works till gc.  :-/

Looks like I'm loosing the length tag.  Sure I do.  I wanted to
re-install it after gc (which invalidates the reusable last av anyway).
 Help I need to find the spot where the stuff saved in
C_save_and_reclaim is being restored.

For reference I attach my current modifications.  (Including Peters
fixes to location-ref to avoid a patch conflict.)

Hints much appreciated.

Cheers

/Jörg

Attachment: avchanges.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]