Great work, Steve! That's fantastic. Still no ideas on label tracks
though. -Roger
Post by Steve the FiddlePost by Roger DannenbergMore below...
Thanks for the response Roger. Comments in-line below.
That's really interesting. I don't know what's going on, but here are some
thoughts...
I found this in some wxPython docs after a quick search: "Yields control to
pending messages in the windowing system. This can be useful, for example,
when a time-consuming process writes to a text window. Without an occasional
yield, the text window will not be updated properly, and on systems with
cooperative multitasking, such as Windows 3.1 other processes will not
respond."
Even when "compute bound", Nyquist DSP and Xlisp interpreter call out
occasionally to poll for events like typing the break character or incoming
Open Sound Control messages.
So I imagine that this polling is directed by Audacity to YieldFor in order
to let wxWidgets update the progress bar.
Also to allow effects to respond to "Cancel".
One would hope you could update
the progress bar about 10-50 times per second, and that that would take a
small fraction of CPU time, the rest going to Nyquist.
I suppose YieldFor is getting called excessively often or takes excessive
amounts of CPU time. Figuring out which is the case (or both) would be the
next step.
It seems to be both.
When there is no label track, on my (Debian) machine, YieldFor is
called around 3000 times per second, which is clearly excessive.
When there is a label track, running an effect such as the High Pass
filter (no LISP looping, just crunching numbers in the C code), calls
to YieldFor drop to around 130 per second because YieldFor is taking
so long.
Maybe if things were adjusted for callbacks at a reasonable rate at
real-time playback speed, and if callbacks are paced by audio buffer
computation, then running flat out, you could be going 50x real time and
3000 would not be an unlikely polling rate. I think given the wide range in
sample rates from simple compute bound filters to real-time (in Nyquist
outside of Audacity), the right thing to do is probably either adaptive
(return immediately from N-1 out of N callbacks, adjusting N to keep a sane
rate), OR check the time at every callback and do work (like YieldFor) every
10ms or so. The latter is approach is simplest, but I'm not sure what it
costs to read the current time on Windows, and we don't want that to become
the bottleneck.
Fortunately we already have the current time because we get it earlier
in the same loop (so that we're not updating the progress bar more
than once per second).
Reusing the time, to call YieldFor no sooner than 50 ms after the
previous call, brings performance virtually up to the level I see with
YieldFor disabled, whether a label track is present or not.
In other words, an easy fix that also more than doubles the speed of
many Nyquist effect (on Linux). I don't expect to see such big gains
on other platforms, but there may be a smaller performance boost.
Post by Roger DannenbergYiedFor is called on every loop through ProgressDialog::Update
Applying High Pass filter on a mono track, 17 mins duration, 44100 Hz.
Time taken = 22 seconds
Number of call to YieldFor = 70381
Time taken = 555 seconds
Number of calls to YieldFor = 72670
Time taken = 8 seconds
Count through Update = about 76000
Time taken = 8 seconds
Count through Update = about 76000
So Yield for is creating a significant slow down even without a label
track, but we really shouldn't be calling it 3000 times per second,
but the thing that is puzzling me is why the slow down becomes
catastrophic when a label track is present.
Yes, that's puzzling. I can't even venture a guess on that one.
It would be good to know as it could be adversely impacting
performance elsewhere.
Anyone have any ideas why this might be?
Steve
Post by Roger DannenbergSteve
I hope this is helpful or at least supports what you've already guessed.
Sorry I don't know any real answers.
-Roger
On Linux, Nyquist effects may run (crawl) as much as 20 times slower
if one or more label tracks are present.
http://bugzilla.audacityteam.org/show_bug.cgi?id=1575
I've traced the problem to the "YieldFor" call in ProgressDialog.cpp
(around line 1265). Even in the absence of label tracks, this YieldFor
slows down Nyquist execution significantly, but the slow down becomes
extreme if label tracks are present
The problem can be mitigated by calling YieldFor less frequently, but
that does not address the question of why the presence of a label
track causes such a huge slow down in YieldFor. Any ideas?
Steve
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
audacity-devel mailing list
https://lists.sourceforge.net/lists/listinfo/audacity-devel
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
audacity-devel mailing list
https://lists.sourceforge.net/lists/listinfo/audacity-devel
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
audacity-devel mailing list
https://lists.sourceforge.net/lists/listinfo/audacity-devel
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
audacity-devel mailing list
https://lists.sourceforge.net/lists/listinfo/audacity-devel
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
audacity-devel mailing list
https://lists.sourceforge.net/lists/listinfo/audacity-devel