I would like to make a dynamic allocated stack structure in Pure Data. The problem is that i need a huge stack with millions of elements. So is there a way to do something like that ? . The stack also contains just basic operations but must be of unknown size. I manage to make it to some extent but it seems to drain CPU. I use some modified Array abstractions but maybe i need to use external files or something else. Many thanks.
-
Dynamic allocated Stack structure in Pure Data ??
-
@Boran-Robert If it's just floats then an array should be very fast. In 64-bit it can be huge. You can pop, push and shift.....address by index.....auto resize etc........ and if you hide it in a sub-patch it should use close to zero cpu.
David. -
@whale-av Yes. It is working with floats but when i try to mess with the data types it gets slower. I would really like to have a more universal stack structure to hold various types of data. The idea is to have a simple structure with complex data. Do you have any idea of some external library to handle different data types then Pure Data ? or i just need somehow to stick with Pure Data data types ? I was also thinking about data type conversion. Like if i need a complex data type maybe i can brake it down to a bunch of simple data types using an idea about data type symmetry. Many thanks anyway. I need to learn more about Pure Data stuff. I don't have extensive knowledge about Pure Data but the concept is brilliant.
-
@Boran-Robert Yes, maybe conversion. A 64-bit float can hold a lot of complexity..... certainly more than you will want to write tables for. But tailored conversion will be inefficient. [text] might then be a better solution. The only downside with [text] will be remembering to write data out to a file before closing the patch.
I am pretty sure it can hold a huge stack..... someone was asking very recently on this forum.Or [list store].......?
Or [list fromsymbol] to write to an array and [list tosymbol] to read should be fast.
Or [fudiparse] and [fudiformat] will do much the same conversion without needing conversion to symbols though and should also write/read with an array?
These objects might be slower than [text] though because you will need to "drip" the integers into the array......... and with text you can easily "get" sequences back from a point in the list.
David. -
You can store the text content with -k. But it could be problematic to store millions of lists, like @whale-av said array is more efficient in that sense. You could also use Lua tables with Ofelia.
-
@whale-av Many thanks.
-
@Jona I know a little bit of Lua programming. But i never thought about Lua tables in combination with Ofelia. Interesting idea. Many thanks . I need to dig into all of your suggestions to see what works. As @whale-av pointed out a 64-bit float can hold a lot. Also i remember something said by Bjarne Stroustrup about arrays, and he proved that C++ can be even faster then C language and with classes.