"adding" colls together

t.a's icon

Hello, I work on a project where I have multiple colls. I want to combine all the lists in there in one single coll. Is there a way to do that directly without unpacking and repacking everything?

In order to be more clear, let's say I have two colls, with the first one being:

0, 2;
1, 4;
2, 4;
....
99, 9;

while the second one is:

100, 8;
101, 4;
...
199, 7;

I would like the final coll to be one list from 0-199.

Please keep in mind I don't want to unpack everything ( with uzi for instance) cause my lists are very long and I find that it is problematic for the cpu to use colls with such long lists.That's why I broke my huge list into sublists/subcolls in the first place

Hope that's clear enough.
Thanks in advance

Floating Point's icon

I don't think there is a non-explicit way but you might be able to do it using javascript (but it may be even less efficient than using an explicit uzi solution); it may be better to approach the problem with the dict system instead of coll ...

t.a's icon

Thanks for the answer, I wasn't aware of "dict" as I still prefer to use Max 5. However do you think that this approach is going to be more cpu friendly than coll? I will try to give a shot with dict later today!

Floating Point's icon

depends how the dict data structure is implemented. I know that coll uses a linked list which is slower to access than other possible data structures, such as a hash table, which dict probably uses...

Max Patch
Copy patch and select New From Clipboard in Max.

here is a benchmark patch with some interesting results (for my computer anyway) --

it seems dict is generally about 10 - 20 times faster than coll, *except* if you use the dump message, where coll is at least 20 times faster than dict...!

broc's icon
Max Patch
Copy patch and select New From Clipboard in Max.

So you may use [dump] for combining colls.

Floating Point's icon
Max Patch
Copy patch and select New From Clipboard in Max.

once you wire up the outputs, it turns out there's not that much difference between dumping 2 colls and concatenating two dicts:

dict is a little faster (10% better) with this simple example...

t.a's icon

Hey thanks for all the answers and the interesting patches. I feel that although dict is much faster on accessing data, Max is overall slow for this kind of job!