guile-devel
[Top][All Lists]
Advanced

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

Re: freeing srcprops ?


From: Neil Jerram
Subject: Re: freeing srcprops ?
Date: Mon, 29 Jan 2007 21:35:00 +0000
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Han-Wen Nienhuys <address@hidden> writes:

> Neil Jerram escreveu:
>> Kevin Ryde <address@hidden> writes:
>> 
>>> Han-Wen Nienhuys <address@hidden> writes:
>>>> why use a separate storage pool for srcprop objects?
>>> At a guess, is it because that they're likely to never need freeing,
>>> hence can be laid down in big blocks.
>> 
>> I'd guess because setting up a srcprops is critical to start-up
>> performance, and a double cell doesn't have enough slots to store all
>> the common properties (filename, pos, copy) directly (as your change
>> makes clear).
>
> All this guessing ...  I suspect it was done just because of poor design
> and/or premature optimization.

Except you haven't given any objective reasons for why the design is
poor or the optimization premature.

> on the factual side: 
>
> 1. the GUILE ends up with 1506 srcprops objects.

Out of interest, in what scenario?

> 2. this is neglible compared to the 431777 total cells that
> are allocated.

(Which suggests to me that the decrease in memory from your change
wasn't that worthwhile.)

> 3. Due to sharing of the filename cons, memory usage is slightly more
> than 4 SCMs per srcprop, down from 6 SCMs (2 for the smob cell, 4 for the
> struct) 

Well that's nice, but only to be expected from throwing away a
performance/occupancy optimization.

> I actually think it would be a good idea to generalize from double cells,
> to cells containing any number between 3 and 8 SCM values.  This would 
> be a better fit with some datatypes, and obviates the procustes
> hacking to fit all the information inside some struct.

Maybe.  I think this would have to be motivated by looking at
particular cases where we get benefits from moving struct data into a
multiple cell.  I don't think the srcprops case is clearcut
(obviously), and I don't see anything wrong with the general approach
of indirecting to a struct.

> Because the code made me cringe. It's pointless to have specialized storage
> for srcprops. it only makes the code more obtuse.

I disagree.  I believe there was point to the code, and it was nowhere
near obtuse.

> I you really want to know, ask Mikael Djurfeldt who added the bits 
> in 20 aug 1996.

I don't think I need to.  Mikael was responsible for adding all
Guile's low-level debugging support, including this.  He took great
care to minimize the impact of this support on runtime performance -
which it seems to me that you are now throwing away because "the code
makes you cringe".

Regards,
     Neil





reply via email to

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