Han-Wen Nienhuys <hanw...@gmail.com> writes:

> Both your hunches were correct:
>
> the code below works, but it makes the GC time go from 2s to 5s.

Have you disabled the call of scm_set_smob_mark in
lily/include/smobs.tcc ?  I mean, not having to use it is what should be
the advantage of this change.

> // GUILE v2 uses the Boehm GC. By allocating all memory through
> // scm_gc_malloc, we ensure that all our data structures are traced
> // for SCM values. As a performance optimization, we could define
> // operator new/delete for data structures that contain just atomic
> // data
> void *
> operator new(std::size_t size) {
>   if (guile_booted) {
>     return scm_gc_malloc(size, "c++ new");
>   }
>   return malloc(size);
> }
>
> void
> operator delete(void *p) {
>   // Don't call GC_FREE or scm_gc_free. GC_free manipulates the
>   // to-be-freed pointer, and we can't guarantee that the pointer
>   // actually comes from GC_MALLOC.
> }

That looks rather crude.  Should be ok for a rough profiling guess, though.

-- 
David Kastrup

Reply via email to