lilypond-devel
[Top][All Lists]
Advanced

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

Re: GUILE 2/3 and string encoding cost


From: David Kastrup
Subject: Re: GUILE 2/3 and string encoding cost
Date: Fri, 24 Jan 2020 18:27:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Han-Wen Nienhuys <address@hidden> 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

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