[Csnd] tables vs arrays
| Date | 2018-04-19 14:02 |
| From | Dave Seidel |
| Subject | [Csnd] tables vs arrays |
Hi all,
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
I am curious about the performance implications of arrays vs tables. For example, if I use GEN51 to build a table of tuning frequencies, one for each MIDI not number, is it any more efficient to copy the resulting table to an array and use it like so ifreq = gi_freq_array[notnum()] vs using the table directly like so ifreq = tablei(notnmum(), gi_freq_table) Thanks, Dave |
| Date | 2018-04-19 14:19 |
| From | Victor Lazzarini |
| Subject | Re: [Csnd] tables vs arrays |
|
We need to measure. The array expression gets expanded to a call to array_get. So the question is whether this opcode is faster than “table”
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
| Date | 2018-04-19 14:44 |
| From | jpff |
| Subject | Re: [Csnd] tables vs arrays |
Not much in it i sspect. A slight overhead in thetable case at init
time.
On Thu, 19 Apr 2018, Dave Seidel wrote:
> Hi all,
>
> I am curious about the performance implications of arrays vs tables. For
> example, if I use GEN51 to build a table of tuning frequencies, one for each
> MIDI not number, is it any more efficient to copy the resulting table to an
> array and use it like so
>
> ifreq = gi_freq_array[notnum()]
>
> vs using the table directly like so
>
> ifreq = tablei(notnmum(), gi_freq_table)
>
> Thanks,
> Dave
>
> Csound mailing list Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here
>
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |
| Date | 2018-04-19 15:07 |
| From | jpff |
| Subject | Re: [Csnd] tables vs arrays |
and of cource tablei interpolates and array access d0es not. So talei
does two lookups while array only does 1 as the arg is rounded
On Thu, 19 Apr 2018, jpff wrote:
> Not much in it i sspect. A slight overhead in thetable case at init time.
>
> On Thu, 19 Apr 2018, Dave Seidel wrote:
>
>> Hi all,
>>
>> I am curious about the performance implications of arrays vs tables. For
>> example, if I use GEN51 to build a table of tuning frequencies, one for
>> each
>> MIDI not number, is it any more efficient to copy the resulting table to an
>> array and use it like so
>>
>> ifreq = gi_freq_array[notnum()]
>>
>> vs using the table directly like so
>>
>> ifreq = tablei(notnmum(), gi_freq_table)
>>
>> Thanks,
>> Dave
>>
>> Csound mailing list Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>> https://github.com/csound/csound/issues Discussions of bugs and features
>> can
>> be posted here
>>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |
| Date | 2018-04-19 16:53 |
| From | Dave Seidel |
| Subject | Re: [Csnd] tables vs arrays |
In this case no interpolation is need. But you're probably right, the perf difference is probably not significant. Will likely use the array version in any case as I prefer the syntax. On Thu, Apr 19, 2018 at 10:07 AM, jpff <jpff@codemist.co.uk> wrote: and of cource tablei interpolates and array access d0es not. So talei does two lookups while array only does 1 as the arg is rounded |