Trigger vs. int

Feb 19, 2006 at 6:37pm

Trigger vs. int

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.

#24504
Feb 19, 2006 at 6:48pm

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://
http://www.cassiel.com

#70980
Feb 19, 2006 at 7:22pm

And in general?

using

int 1 instead of t 1?

#70981
Feb 19, 2006 at 9:38pm

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

http://www.davidstanford.com/david/max/showdown.zip

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

#70982
Feb 19, 2006 at 10:09pm

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

#70983
Feb 19, 2006 at 10:35pm

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.

#70984
Feb 20, 2006 at 12:09am

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:

http://www.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 v2;
#N vpatcher 640 62 1050 219;
#P origin 0 52;
#P button 5 24 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 5 45 57 196617 Uzi 10000;
#P flonum 65 71 59 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 525 182 715 430;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 96 82 13 196617 b;
#P newex 96 104 46 196617 cpuclock;
#P newex 66 143 27 196617 – 0.;
#P newex 48 82 13 196617 b;
#P newex 48 104 46 196617 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 3 0;
#P connect 3 0 2 0;
#P connect 5 0 4 0;
#P connect 4 0 7 0;
#P connect 2 0 4 1;
#P connect 1 0 6 0;
#P connect 6 0 5 0;
#P pop;
#P newobj 65 45 55 196617 p cputimer;
#P button 129 24 15 0;
#P newex 129 45 57 196617 Uzi 10000;
#P flonum 189 71 59 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 525 182 715 430;
#N comlet interval in ms is reported here;
#P outlet 66 173 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 96 82 13 196617 b;
#P newex 96 104 46 196617 cpuclock;
#P newex 66 143 27 196617 – 0.;
#P newex 48 82 13 196617 b;
#P newex 48 104 46 196617 cpuclock;
#N comlet bang stops timing and reports interval;
#P inlet 96 58 15 0;
#N comlet bang starts timing interval;
#P inlet 48 58 15 0;
#P connect 0 0 3 0;
#P connect 3 0 2 0;
#P connect 5 0 4 0;
#P connect 4 0 7 0;
#P connect 2 0 4 1;
#P connect 1 0 6 0;
#P connect 6 0 5 0;
#P pop;
#P newobj 189 45 55 196617 p cputimer;
#N vpatcher 110 52 438 290;
#P origin 70 51;
#P inlet 0 21 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 242 174 31 196617 int 1;
#P newex 242 155 31 196617 int 1;
#P newex 242 136 31 196617 int 1;
#P newex 242 117 31 196617 int 1;
#P newex 242 98 31 196617 int 1;
#P newex 242 79 31 196617 int 1;
#P newex 242 60 31 196617 int 1;
#P newex 242 41 31 196617 int 1;
#P newex 207 173 31 196617 int 1;
#P newex 207 154 31 196617 int 1;
#P newex 207 135 31 196617 int 1;
#P newex 207 116 31 196617 int 1;
#P newex 207 97 31 196617 int 1;
#P newex 207 78 31 196617 int 1;
#P newex 207 59 31 196617 int 1;
#P newex 207 40 31 196617 int 1;
#P newex 173 174 31 196617 int 1;
#P newex 173 155 31 196617 int 1;
#P newex 173 136 31 196617 int 1;
#P newex 173 117 31 196617 int 1;
#P newex 173 98 31 196617 int 1;
#P newex 173 79 31 196617 int 1;
#P newex 173 60 31 196617 int 1;
#P newex 173 41 31 196617 int 1;
#P newex 138 173 31 196617 int 1;
#P newex 138 154 31 196617 int 1;
#P newex 138 135 31 196617 int 1;
#P newex 138 116 31 196617 int 1;
#P newex 138 97 31 196617 int 1;
#P newex 138 78 31 196617 int 1;
#P newex 138 59 31 196617 int 1;
#P newex 138 40 31 196617 int 1;
#P newex 104 174 31 196617 int 1;
#P newex 104 155 31 196617 int 1;
#P newex 104 136 31 196617 int 1;
#P newex 104 117 31 196617 int 1;
#P newex 104 98 31 196617 int 1;
#P newex 104 79 31 196617 int 1;
#P newex 104 60 31 196617 int 1;
#P newex 104 41 31 196617 int 1;
#P newex 69 173 31 196617 int 1;
#P newex 69 154 31 196617 int 1;
#P newex 69 135 31 196617 int 1;
#P newex 69 116 31 196617 int 1;
#P newex 69 97 31 196617 int 1;
#P newex 69 78 31 196617 int 1;
#P newex 69 59 31 196617 int 1;
#P newex 69 40 31 196617 int 1;
#P newex 34 172 31 196617 int 1;
#P newex 34 153 31 196617 int 1;
#P newex 34 134 31 196617 int 1;
#P newex 34 115 31 196617 int 1;
#P newex 34 96 31 196617 int 1;
#P newex 34 77 31 196617 int 1;
#P newex 34 58 31 196617 int 1;
#P newex 34 39 31 196617 int 1;
#P newex 0 173 31 196617 int 1;
#P newex 0 154 31 196617 int 1;
#P newex 0 135 31 196617 int 1;
#P newex 0 116 31 196617 int 1;
#P newex 0 97 31 196617 int 1;
#P newex 0 78 31 196617 int 1;
#P newex 0 59 31 196617 int 1;
#P newex 0 40 31 196617 int 1;
#P connect 64 0 0 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 7 0;
#P connect 7 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 19 0;
#P connect 19 0 20 0;
#P connect 20 0 21 0;
#P connect 21 0 22 0;
#P connect 22 0 23 0;
#P connect 23 0 24 0;
#P connect 24 0 25 0;
#P connect 25 0 26 0;
#P connect 26 0 27 0;
#P connect 27 0 28 0;
#P connect 28 0 29 0;
#P connect 29 0 30 0;
#P connect 30 0 31 0;
#P connect 31 0 32 0;
#P connect 32 0 33 0;
#P connect 33 0 34 0;
#P connect 34 0 35 0;
#P connect 35 0 36 0;
#P connect 36 0 37 0;
#P connect 37 0 38 0;
#P connect 38 0 39 0;
#P connect 39 0 40 0;
#P connect 40 0 41 0;
#P connect 41 0 42 0;
#P connect 42 0 43 0;
#P connect 43 0 44 0;
#P connect 44 0 45 0;
#P connect 45 0 46 0;
#P connect 46 0 47 0;
#P connect 47 0 48 0;
#P connect 48 0 49 0;
#P connect 49 0 50 0;
#P connect 50 0 51 0;
#P connect 51 0 52 0;
#P connect 52 0 53 0;
#P connect 53 0 54 0;
#P connect 54 0 55 0;
#P connect 55 0 56 0;
#P connect 56 0 57 0;
#P connect 57 0 58 0;
#P connect 58 0 59 0;
#P connect 59 0 60 0;
#P connect 60 0 61 0;
#P connect 61 0 62 0;
#P connect 62 0 63 0;
#P pop;
#P newobj 129 71 45 196617 p 64 int;
#N vpatcher 110 52 404 297;
#P origin 70 51;
#P inlet 0 21 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 242 174 21 196617 t 1;
#P newex 242 155 21 196617 t 1;
#P newex 242 136 21 196617 t 1;
#P newex 242 117 21 196617 t 1;
#P newex 242 98 21 196617 t 1;
#P newex 242 79 21 196617 t 1;
#P newex 242 60 21 196617 t 1;
#P newex 242 41 21 196617 t 1;
#P newex 207 173 21 196617 t 1;
#P newex 207 154 21 196617 t 1;
#P newex 207 135 21 196617 t 1;
#P newex 207 116 21 196617 t 1;
#P newex 207 97 21 196617 t 1;
#P newex 207 78 21 196617 t 1;
#P newex 207 59 21 196617 t 1;
#P newex 207 40 21 196617 t 1;
#P newex 173 174 21 196617 t 1;
#P newex 173 155 21 196617 t 1;
#P newex 173 136 21 196617 t 1;
#P newex 173 117 21 196617 t 1;
#P newex 173 98 21 196617 t 1;
#P newex 173 79 21 196617 t 1;
#P newex 173 60 21 196617 t 1;
#P newex 173 41 21 196617 t 1;
#P newex 138 173 21 196617 t 1;
#P newex 138 154 21 196617 t 1;
#P newex 138 135 21 196617 t 1;
#P newex 138 116 21 196617 t 1;
#P newex 138 97 21 196617 t 1;
#P newex 138 78 21 196617 t 1;
#P newex 138 59 21 196617 t 1;
#P newex 138 40 21 196617 t 1;
#P newex 104 174 21 196617 t 1;
#P newex 104 155 21 196617 t 1;
#P newex 104 136 21 196617 t 1;
#P newex 104 117 21 196617 t 1;
#P newex 104 98 21 196617 t 1;
#P newex 104 79 21 196617 t 1;
#P newex 104 60 21 196617 t 1;
#P newex 104 41 21 196617 t 1;
#P newex 69 173 21 196617 t 1;
#P newex 69 154 21 196617 t 1;
#P newex 69 135 21 196617 t 1;
#P newex 69 116 21 196617 t 1;
#P newex 69 97 21 196617 t 1;
#P newex 69 78 21 196617 t 1;
#P newex 69 59 21 196617 t 1;
#P newex 69 40 21 196617 t 1;
#P newex 34 172 21 196617 t 1;
#P newex 34 153 21 196617 t 1;
#P newex 34 134 21 196617 t 1;
#P newex 34 115 21 196617 t 1;
#P newex 34 96 21 196617 t 1;
#P newex 34 77 21 196617 t 1;
#P newex 34 58 21 196617 t 1;
#P newex 34 39 21 196617 t 1;
#P newex 0 173 21 196617 t 1;
#P newex 0 154 21 196617 t 1;
#P newex 0 135 21 196617 t 1;
#P newex 0 116 21 196617 t 1;
#P newex 0 97 21 196617 t 1;
#P newex 0 78 21 196617 t 1;
#P newex 0 59 21 196617 t 1;
#P newex 0 40 21 196617 t 1;
#P connect 64 0 0 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 7 0;
#P connect 7 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 19 0;
#P connect 19 0 20 0;
#P connect 20 0 21 0;
#P connect 21 0 22 0;
#P connect 22 0 23 0;
#P connect 23 0 24 0;
#P connect 24 0 25 0;
#P connect 25 0 26 0;
#P connect 26 0 27 0;
#P connect 27 0 28 0;
#P connect 28 0 29 0;
#P connect 29 0 30 0;
#P connect 30 0 31 0;
#P connect 31 0 32 0;
#P connect 32 0 33 0;
#P connect 33 0 34 0;
#P connect 34 0 35 0;
#P connect 35 0 36 0;
#P connect 36 0 37 0;
#P connect 37 0 38 0;
#P connect 38 0 39 0;
#P connect 39 0 40 0;
#P connect 40 0 41 0;
#P connect 41 0 42 0;
#P connect 42 0 43 0;
#P connect 43 0 44 0;
#P connect 44 0 45 0;
#P connect 45 0 46 0;
#P connect 46 0 47 0;
#P connect 47 0 48 0;
#P connect 48 0 49 0;
#P connect 49 0 50 0;
#P connect 50 0 51 0;
#P connect 51 0 52 0;
#P connect 52 0 53 0;
#P connect 53 0 54 0;
#P connect 54 0 55 0;
#P connect 55 0 56 0;
#P connect 56 0 57 0;
#P connect 57 0 58 0;
#P connect 58 0 59 0;
#P connect 59 0 60 0;
#P connect 60 0 61 0;
#P connect 61 0 62 0;
#P connect 62 0 63 0;
#P pop;
#P newobj 5 71 37 196617 p 64 t;
#P connect 9 0 8 0;
#P connect 8 0 0 0;
#P connect 9 0 6 0;
#P connect 6 0 7 0;
#P fasten 8 1 6 1 33 65 123 65 123 42 115 42;
#P connect 5 0 4 0;
#P connect 4 0 1 0;
#P connect 5 0 2 0;
#P connect 2 0 3 0;
#P fasten 4 1 2 1 157 65 245 65 245 42 239 42;
#P pop;

#70985
Feb 20, 2006 at 1:10am

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

#70986

You must be logged in to reply to this topic.