Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV:3099] Major performance issues with 4.23 on OS 9

Date2003-09-29 18:20
FromAnthony Kozar
Subject[CSOUND-DEV:3099] Major performance issues with 4.23 on OS 9
I've mentioned this once before, but has anyone else noticed that there are
some very serious performance issues with Perf 4.23 on Mac OS 9?

To illustrate, I have just finished running the old benchmark suite of
scores on three different versions of Csound:

Csound Version 4.22 (Oct 28 2002) running under Mac OS 9.1
Csound Version 4.23 (Apr  7 2003) running under Mac OS 9.1
Csound Version 4.23 (12/24/02) running under Mac OS X 10.1.5

All three versions were tested on my PowerMac G3 266Mhz with 320MB RAM.
When running under OS 9, I had 64MB allocated to Perf, virtual memory off,
and a 16MB disk cache.  All other conditions were identical while I was
testing under OS 9.  Also, I ran each test three times for each of the two
OS 9 versions and averaged the results.

Here are the numbers:

test file         Perf 4.22   Perf 4.23   4.23(OS X)  4.23/4.22 ratio
----------------------------------------------------------------------

bach.orc/sco      5.47220     438.809     4.753       80x
risset1.orc/sco   2.92221     47.1720     3.726       16x
guitar.orc/sco    3.82776     94.9163     3.697       25x
james.orc/sco     0.64444     22.9832     1.350       36x
lptest.aif        9.46663     9.47774     1.622       1x
pvtest.aif        8.76108     8.78885     4.929       1x

The fourth column of numbers show the approximate ratio between 4.23 and
4.22 under OS 9.  The ratio for the bach score is the largest I have ever
seen.  Slowdowns of 10 to 35 times are more normal.  The amount of slowdown
seems related to the orchestra being used.  The utilities seem unaffected by
whatever is causing scores to render so much slower.

Clearly there is something seriously wrong.  The problem does seem isolated
to the Mac OS 9 platform as the OS X times are similar to the 4.22 results.
Unfortunately, I was unable to test Matt's MacCsound under OS 9 to see if it
had the same problems.  I am wondering if some of the tweaks introduced in
4.23 to improve performance on linux haven't had a negative impact on the
Mac's performance? 

Does anyone have any idea what could be wrong?

(Note that recompiling Perf 4.23 with full optimizations on did not help at
all).

Thanks.

Anthony Kozar
anthony.kozar@utoledo.edu

Date2003-10-02 12:22
FromJ P Fitch
Subject[CSOUND-DEV:3111] Re: Major performance issues with 4.23 on OS 9
Away from base, but could this be the dreaded GUI problem, where it polls 
the system too often?  It is possible that POLL_EVENTS is being called too 
often in some opcode?  Apart from that i cannot think of anything that 
would cause such a problem.
==John

Date2003-10-02 16:58
FromAnthony Kozar
Subject[CSOUND-DEV:3112] Re: Major performance issues with 4.23 on OS 9
That had not occurred to me.  I will try to do some profiling in the next
couple of days to see if this is true.

Thanks John.

Anthony Kozar
anthony.kozar@utoledo.edu


On 10/2/03 7:22 AM, J P Fitch etched in stone:

> Away from base, but could this be the dreaded GUI problem, where it polls
> the system too often?  It is possible that POLL_EVENTS is being called too
> often in some opcode?  Apart from that i cannot think of anything that
> would cause such a problem.
> ==John
> 

Date2003-10-04 17:44
FromAnthony Kozar
Subject[CSOUND-DEV:3115] Re: Major performance issues with 4.23 on OS 9
Well, John, it seems that you hit it directly on the nose.

On the Mac, POLL_EVENTS is defined as a call to a function called STasks().
So I added a simple static variable to count the number of times STasks was
called.

I tried each version on the same test files, a simple orchestra and a score
with only 6 notes.  Version 4.23 called POLL_EVENTS 35,414 times!  And
version 4.22 called it a mere 135 times.

This would definitely seem to be the performance problem.  I do not know
which opcodes are affected, but the test.orc that I used is given below and
may give some idea of where to start looking.

I am sorry that I do not know more about the Csound code base or I would
attempt to fix these problems myself.  I am happy to continue using Perf
4.22 though for now :)

Thanks for the help!

Anthony Kozar
anthony.kozar@utoledo.edu


; ***  test.orc  ***

sr      = 44100
kr      = 4410
ksmps    = 10
nchnls  = 1

; simple table-lookup oscillator instrument with 2nd oscillator for envelope
; the 2nd oscillator will be played for exactly one period
instr 202

    idur    = p3
    iamp    = p4                                ; constant value btw 0 and 1
    ifreq   = p5
    ifnum   = p6
    ienvnum = p7
    ilen    = ftlen(ifnum)
    ienvlen = ftlen(ienvnum)
    
    aenvph  phasor    1/idur                    ; envelope oscillator
    aenv    tablei    aenvph*ienvlen, ienvnum
    aphase  phasor    ifreq                     ; waveform oscillator
    asig    tablei    aphase*ilen, ifnum
    
            out        asig*aenv*iamp
            
endin

Date2003-10-05 21:04
From"Matt J. Ingalls"
Subject[CSOUND-DEV:3116] Re: Major performance issues with 4.23 on OS 9
no opcode should call POLL_EVENTS, should it?
-m





On Thu, 2 Oct 2003, J P Fitch wrote:

> Away from base, but could this be the dreaded GUI problem, where it polls
> the system too often?  It is possible that POLL_EVENTS is being called too
> often in some opcode?  Apart from that i cannot think of anything that
> would cause such a problem.
> ==John
>
>