SynthMaker

Synthmaker Slowdown on Array Initialization of BIG Arrays

Archive · 2005 4 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

rl ·

Once again I tried to push SM to the max. I know that I did some "not officially supported" things, but I thought I share my observations:

In order to play sampled data through the code component I wrote a small program that transforms wave files into float arrays.

The result looks like this:

monoout o;

float samples[6699]; stage(0) { samples [0] = -0.00895691; samples [1] = -0.01460266; samples [2] = -0.01992798; samples [3] = -0.01992798; samples [4] = -0.01205444; samples [5] = 0.00076294; samples [6] = 0.01417542; samples [7] = 0.02403259; ..... samples [6698] = ....

On the first naive attempt to cut&paste the 6699 initializations into the code component SM hang - according to the task manager it was busy allocating memory - so I tried with smaller chunks. Starting with 100 lines SM then slowed remarkably down, at 200 lines it was almost unusable.

more observations: Viewing the assembled code SM creates temporary variables for each float literal

float temp=0.0; int arrayindex=0; float smzero=0; float samplesmax=6698.000000; float F0P000000=0.000000; float FM0P008957=-0.008957; float F1P000000=1.000000; float FM0P014603=-0.014603; float F2P000000=2.000000; float FM0P019928=-0.019928; ...

after creating lots of literals the array ist filled:

float samples[6699]; stage0; //ArrayIndex> sLeft=F0P000000 //ArrayIndex> m_sAssignVar=samples movaps xmm0,F0P000000; maxps xmm0,smzero; minps xmm0,samplesmax; movaps temp,xmm0; fld temp[0]; fistp arrayindex[0]; fld temp[1]; fistp arrayindex[1]; fld temp[2]; fistp arrayindex[2]; fld temp[3]; fistp arrayindex[3];

I don't know, whether this has some impact on performance. Also note that SSE registers are filled, but at this stage the code only has a monoout connector.

Q: - are there soft/hard limits on lines of code, array sizes, max indices? - are there best practices with array initialization?

Shifrin ·

rl wrote: In order to play sampled data through the code component I wrote a small program that transforms wave files into float arrays.

That's a sneaky idea 😉

Very lateral!

Shif.

unkargherth ·

Try to move out array inicializtion out of stage(0). I know that it is the WORST practice. but i've got some problems with stage(0) sections

Anyway, AFAIK, initializing more or less static, big arrays in code modules is, by now very heavy. on mono sections , they get re-initiailzed on every re-link ( for example when you cahange the value of a selector or multiplexer index). Still worst in poly sections. They get reinitialized every Note On

I suspect that, to allow big arrays in code, first we need to things

.-A way to initialize static arrays out of the "per sample" or "per note" basis ( globals could be nice, but don't know if it's feasible )

.-Some way to move array data easily and fast from outside to inside and reverse

Of course, only my opinion...

Tom7777 ·

Half of the schamtics i have made have big slowdown in them, although not directly related to code most of the time but i think that if SM gets optimized a load then it will fix a load of slowdown for various situations, im guessing that Jorge and Malc are focusing on Key modules/features at the moment but after V1 is released hopefully a load of time will get put into making SM run as fast as possible.

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.