lilypond-user
[Top][All Lists]
Advanced

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

Re: Solution to 7 over sqr(71) time against integer polyrhythms


From: David Kastrup
Subject: Re: Solution to 7 over sqr(71) time against integer polyrhythms
Date: Fri, 18 Nov 2016 19:31:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Carl Sorensen <address@hidden> writes:

> On 11/18/16 8:11 AM, "David Kastrup" <address@hidden> wrote:
>
>>Carl Sorensen <address@hidden> writes:
>>
>>> On 11/18/16 2:46 AM, "David Kastrup" <address@hidden> wrote:
>>>
>>>>
>>>>
>>>>GMP is already linked into Guile exactly for that purpose.  It would not
>>>>really make a lot of sense to use it independently.
>>>
>>> You are certainly more qualified than me to comment on this.  However,
>>> it appeared to me that using the C++ interface to GMP allowed the
>>> memory allocation problem to be handled more easily from C++.  But I
>>> haven't tried any of it.
>>
>>It would cause a lot of additional heap churn for passing around the
>>Rational type (it is usually passed by value rather than by reference).
>>Using Guile instead would mean that only references (namely an Scm
>>value) are passed around which do not require allocation/deallocation
>>for multiple "copies".
>>
>>We really don't want to open the can of worms of an additional memory
>>management subsystem.
>
> That makes sense.
>
> Thanks for enlightening me.

Well, it's a valid idea and certainly one that would require touching
less code overall.  But it would put even more of a separation between
Guile's rationals and the stuff we work with in C++ Moment structures.

I've given it thought of my own and admittedly made my own decision
process without bothering to involve anybody else in the discussion.  In
the long haul it is obviously the business for the person doing the
actual implementation to make those decisions.

Even Guile 1.8 has

 -- C Function: void scm_to_mpz (SCM val, mpz_t rop)
     Assign VAL to the multiple precision integer ROP.  VAL must be an
     exact integer, otherwise an error will be signalled.  ROP must
     have been initialized with `mpz_init' before this function is
     called.  When ROP is no longer needed the occupied space must be
     freed with `mpz_clear'.  *Note Initializing Integers:
     (gmp)Initializing Integers, for details.

 -- C Function: SCM scm_from_mpz (mpz_t val)
     Return the `SCM' value that represents VAL.

so one could bounce the constituents of rationals between libgmp and
Guile.  But, well, ugh.

-- 
David Kastrup



reply via email to

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