This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Making Guile slower


Charbel JACQUIN <cjacquin@objetdirect.com> writes:

> Mikael Djurfeldt wrote:
> > 
> > Greg Harvey <Greg.Harvey@thezone.net> writes:
> > 
> > > Consider this:
> > >
> > > SCM_NEWCELL(foo);
> > > SCM_SETCDR(foo, scm_must_malloc(foo_size, s_make_foo));
> > > SCM_SETCAR(foo, scm_tc16_foo);
> > 
> > .. which should be written ...
> > 
> >   m = scm_must_malloc (foo_size, s_make_foo);
> >   SCM_NEWCELL (foo);
> >   SCM_SETCDR (foo, m);
> >   SCM_SETCAR (foo, scm_tc16_foo);
> > 
> > Wouldn't it be a solution, then, to abstract away this idiom, e.g. as
> > a macro, so that we both gain readability, safer code, and get the
> > freedom still to choose an efficient from of the NEWCELL operation
> > itself?
> 
> In cvs there is already SCM_NEWSMOB(foo, scm_tc16_foo, m)
> and SCM_RETURN_NEWSMOB(scm_tc16_foo, m) for this purpose.

Right.

And, if it turns out that this isn't sufficient, and that people
anyway get GC problems with roots here, then---sure---we could perhaps
sacrifice 5% of performance in order to achieve greater robustness.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]