Hi Krzysztof,,
I don't really understand, what you're asking. Shall we do experiments on our own and share the results? In my externals I normally use the preallocation method as it guarantees to be somewhat fast, but the getbytes method has its own advantages in being more flexible due to its dynamic nature. Apart from that the getbytes methos can make prototyping in many cases much faster, too (as you don't have to maintain dangling pointers).
-- Orm.
Am Donnerstag, den 06. Juni 2002 um 16:44:51 Uhr (+0200) schrieb Krzysztof Czaja:
hi,
perhaps all the more experienced Pd coders did not notice this thread (or my question was badly posed)? Anyway, I would like to try once again, this time with some measurement data (not very hard data yet)...
...on my system, using method 5 as a reference, on average:
. method 1 performs 2.5 times slower,
. method 4 is 4.25 times slower and has nasty peaks.
For each method there are two objects in my test patch: one outputs a message stored internally (no copying cost in case of method 5), the other appends its internal message to a message passed from the first object.
Whoever likes to try the same (lame) test, and make further experiments, might grab the newest cyclone snapshot, wherein there is a 'testmess' class and a testmess-test.pd test patch.
Krzysztof
Krzysztof Czaja wrote: ...
what is the proper way (fast, robust, surviving Pd api changes) for an external to send arbitrarily long messages, if these messages contain a mix of data acquired through inlets and data stored in an object?
...
- copy data to the main stack, i.e. use a buffer in the local
memory space of a function;
...
- allocate with getbytes() in every call
...
- use a pre-allocated buffer stored in an object's memory space,
PD-dev mailing list PD-dev@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-dev
hi Orm,
Orm Finnendahl wrote: ...
I don't really understand, what you're asking. Shall we do experiments on our own and share the results?
not if you trust my results :)
Actually I do not trust them either, because there are just too many things to account for in designing the tests. The outcome is quite obvious: allocating in each call is expensive. But how expensive, and does it really matter in practice? After doing the maths I found out that 1) the average cost of one getbytes/freebytes pair is somewhere around memcpying of 120 atoms, and 2) I do not know what this really means.
Perhaps this is all a matter of taste? So I simply need some guidance from people more experienced than myself, and with a better taste than mine.
Anyway, I tried to explain what I am up to in my first post:
I am asking this in the context of porting max classes to Pd. I suspect, that most of the originals use method no 1.
In many cases, the only trouble in porting a max class to Pd is to answer the very same question I am asking in this thread.
It is about: choose the best way now, then reuse'' vs.
make ad hoc decision each time there is some spare time to spend
coding next class''...
Krzysztof