[PD] fast way to convert two 8 bit data to one 16 bit data in big lists ?

Benjamin ~ b01 benjah at free.fr
Wed Sep 30 10:02:11 CEST 2020


hi,

nice to see the different ways in Pd to get to the same destination,
thanks to all for the replies

Le 25/09/2020 à 12:18, IOhannes m zmölnig a écrit :
> On 2020-09-25 00:30, Benjamin ~ b01 wrote:
>> hi,
>>
>> I'm looking for a fast way to convert two 8 bit data to one 16 bit data
>> in big lists
>> a device send continuously packets of 16 000 bytes threw the network to
>> udpreceive
>> at the moment, to reconstitute from two bytes a 16 bit value, I'm using
>> a list-drip and a counter to discriminate the MSB and LSB and do the
>> *256 and + operation
>> the aim is to feed a table with the result (see attached) and produce
>> sound from it
>> it works with packets of 2 000 bytes but pd freeze with bigger packets
>> I'm wondering if there is a better way to achieve this ?
> [...]
>
> doing quick benchmarks gives the following results:
>
> | implemtation     | time (length=100000) |
> |------------------|----------------------|
> | 1 (repack/array) | 1.8ms                |
> | 2 (repack/tab)   | 9.9ms                |
> | 3 (list/array)   | 8.6ms                |
> | 4 (list/tab)     | 9.8ms                |
> | 5 (list-drip/tab)| 29.8ms               |
>

repack/array (attached) was indeed much faster, I can now receive packets of 32768 bytes and convert them in 16 bit values, put them in a table and play them without audio drops

> but nowhere do i experience anything like *freezing* Pd.
first tests were made with an old celeron laptop doing something else at
the same time (I should try again), tests above were made on a i5 CPU @
2.30GHz
> afaict, you should do more benchmarking to find out where the actual
> bottleneck(s) in your patch is (resp: are). it might *not* be the
> conversion from bytes to short integers.
I would say :
1. list-drip
2. conversion from bytes to short integers

thks again
++
benjamin
>
> gsmt
> IOhannes
>
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Convert8to16repack.pd
Type: text/x-pd-l2ork
Size: 728 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20200930/baf8d0c3/attachment.bin>


More information about the Pd-list mailing list