Trigger vs. int

Maarten's icon

What is more memory and CPU efficient?

Loadbang
|
t 1

or

Loadbang
|
int 1

I'm trying to get as much of my patches as possible.
I know both of them are so small operations that you wouldn't even
notice, so look at it as if I want to be puristic efficient in my
programming.

nick rothwell | project cassiel's icon

Loadbang will be called by the GUI thread when the patcher is loaded,
and it's only called once, so it's going to make not one iota of
difference in this situation.

[loadmess 1] saves on patcher real estate, though.

nick rothwell -- composition, systems, performance -- http://
www.cassiel.com

Maarten's icon

And in general?

using

int 1 instead of t 1?

David Stanford's icon

Yes. The example below pits 1024 [int 1] objects against 1024 [t 1]
objects:

The patch is too big to include as text. I'll leave the file up for the
next week or so, then it'll go away.

Also - Check out the Efficiency section in the Max Tutorials and Topics
pdf. There's loads of good information there.

-David

Maarten's icon

Definitly int 1 over t 1.

I've read something like this in the section mentioned but I was
looking for it in the forums

Leafcutter John's icon

Im not sure that patch proves which is most memory or CPU efficient.

Personally i don't really care, but i did find that if i chain together more than 2 of the sub-patchers containing the t's or i's i get a stack overflow. That seems a bit strange to me.....

Anyone have a clue what's going on with that?

best john.

David Stanford's icon

Ooof - stack overflow. Ouch. I don't know why, but it definitely seems
wrong. I was basing my test on another that appeared on the list a
while back:

https://cycling74.com/forums/index.php?
t=msg&goto=28270&rid=0&S=798009278dd2011c2060452 7c700c467&sr ch=efficienc
y#msg_28270

Basically, whenever I want to test the CPU efficiency of an object I
use either the method I posted before (tons of objects strung
together), or the one now posted below, so if either method is wrong,
or one is better than the other, I'd really love to know.

-David

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

Leafcutter John's icon

I don't think it's a bad test at all. but sometimes efficiency is not all about raw speed. It's interesting to see the difference between the speeds of t vs. i though.

best,

john