On Mon, 5 Oct 2009, Loic Kessous wrote:

thanks Mathieu, it is still not clear for me what make things faster in one case or another but it helps.

1. data spacing: the more your data is spaced in memory, the more the cache has to load lots of data, because it assumes that the data is not very fragmented. Pd in 64-bit mode spends half of the argv space on padding. Here by spacing I mean the difference of starting position of two elements next to each other (e.g. where are $1 and $2 in RAM).

2. data element size: when the data doesn't have padding, this is the same as data spacing. Pd in in any mode spends half of the nonpadding argv space on type information.

3. type checking: if you have to check that every element of an argv is indeed a float, you need to use twice more data, and it's twice more spacing, but on top of that you need one conditional per element, just in case it isn't a float, and conditionals are getting comparatively slow on modern CPUs because they're harder to accelerate than the rest.

4. time fragmentation: a low block size may mean the CPU has to reload things in the cache more often, if the CPU's other tasks need the same cache for other purposes between the processing of two blocks. Bigger blocks mean that the CPU can "concentrate". Having to repeatedly call, init, deinit, return, is also something that can take time.

5. cache fitting: repeatedly making long sweeps on very long arrays can make the cache completely useless. it's better to do as many things as possible on a small area of RAM at a time.

Based on those five criteria, we could compare various storage and computation strategies of various internals and externals of pd, provided that we get a bit more precise on some things. There may also be additional criteria.

loic PS: what do you call Martin's strings ?

I thought I knew, but I borked that. Martin's strings are [mrpeach/str], but they don't use pd lists of floats, they use a custom atom type called BLOB, which is essentially a form of double-indirection. (POINTER is also a double-indirection, but it was meant for DS, though it's often hijacked to be used in other ways.)

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to