denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] Paste


From: Richard Shann
Subject: Re: [Denemo-devel] Paste
Date: Tue, 29 Mar 2011 08:09:14 +0100

On Mon, 2011-03-28 at 23:00 +0200, Nils Gey wrote:
> Hello list,
> 
> the following script inserts 300 measures into 4 staffs with random
> chromatic notes, selects and copies all and then paste everything into
> a new movement. The paste part has a timer running. On my laptop it
> took 141 seconds to paste, which feels very slow.
What is happening is that the time to paste is going up as the square of
the number of objects in a staff when pasting all the objects.
This can be reduced to going up linearly by avoiding re-calculating all
the beams/stems/xes at each call to insert an object.
The sophisticated way to do this would be to create a flag on a staff
which indicates if the calculation is needed, and ensuring it is done
before display actually happens. And then replace all the calls to
perform this calculation with setting the flag instead.
As usual in crufty old code, we may hit problems.
Simple would be to create a call that does the calculation, and make the
paste of the clipobjs just do the primitive object insertion, leaving it
up to the scripter to get the display sorted out after pasting
everything.
I prefer the first, though I have, personally, no real interest, not
having much use for cut and paste. (This is just starting to change as I
am working on creating realizations of figured bass by playing, and one
step involves pasting the bass note, which will incur this time
penalty).

Richard

> 
> I have no comparison, not to my normal, faster, computer and not to the
> old variant (both the old scheme variant and the "old" pasteclibobj
> with playback) so I don't know if anything changed to faster or even
> slower.
> 
> But the script is nice to run anyway :)
> 
> Nils
> 
> (Repeat d-NotationMagick-TwelveToneRow 100)
> (d-AddAfter)
> (Repeat d-NotationMagick-TwelveToneRow 100)
> (d-AddAfter)
> (Repeat d-NotationMagick-TwelveToneRow 100)
> (d-AddAfter)
> (Repeat d-NotationMagick-TwelveToneRow 100) 
> (d-SelectAllStaffs)
> (d-Copy)
> (d-InsertMovementAfter)
> (d-MoveToMovementBeginning)
> (d-WarningDialog "Pasting begins now")
> (define timerstart (car (gettimeofday)))
> (d-Paste)
> (define timerend (car (gettimeofday)))
> (d-WarningDialog (string-append "Pasting took " (number->string (-
> timerend timerstart)) " seconds" ))
> 
> _______________________________________________
> Denemo-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/denemo-devel




reply via email to

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