[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: =?utf-8?Q?=E2=80=98new_text-spanner=E2=80=99?= development
From:       David Kastrup <dak () gnu ! org>
Date:       2015-09-24 14:53:29
Message-ID: 877fnf6f86.fsf () fencepost ! gnu ! org
[Download RAW message or body]

David Nalesnik <david.nalesnik@gmail.com> writes:

> Hi,
>
> On Wed, Sep 23, 2015 at 7:35 AM, David Nalesnik <david.nalesnik@gmail.com>
> wrote:
>
>>
>>
>> On Wed, Sep 23, 2015 at 6:54 AM, David Kastrup <dak@gnu.org> wrote:
>>
>> the following open-coded loop is
>>> both opaque and inefficient (namely O(n^2) as _appending_ to a list is
>>> an O(n) operation):
>>>
>>>
>> OK, thanks!  Will update accordingly.
>>
>>
> I removed that idiom from the code, so it should be somewhat more efficient.

Well, the efficiency is not likely a concern for most use cases here.
But of course, once a text spanner like that is available, one can
indeed let it accompany a whole piece with hundreds or thousands of
elements.  And then it may become quite noticeable.

While O(n^2) code is sort of an automatic trigger for programmer
neuroses for me, I was more concerned about the readability.  Use of
"map" makes the relation between input and output more transparent.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic