Hallo, padawan12 hat gesagt: // padawan12 wrote: > Is it just me though or is [expr ] really slow? I try to avoid it > because almost every patch that uses [expr] on my machine runs about > 50% slower than the equivilent arithmetic using atomic ops.
Attached is a simple benchmark patch, which benchmarks taking the inverse in e/b-calc. Here builtin and expr are almost the same speed, builtin is only slightly faster. However as soon as you collect longer chains of calculations into one expr-object it beats the crap out of atomic ops, as the e/b-complex benchmark shows. If it doesn't pulp the atomic ops in your Pd installation, then there's something very wrong. ;) Ciao -- Frank Barknecht _ ______footils.org_ __goto10.org__
#N canvas 326 164 736 482 10; #N canvas 0 0 450 300 bm 0; #X restore 218 423 pd bm; #X obj 100 381 s pd-bm; #X msg 220 349 clear; #X obj 100 269 until; #X obj 100 200 t b b; #X floatatom 210 154 5 0 0 2 howmany - -; #X obj 100 146 bng 32 250 50 0 empty empty test-x 0 -6 0 8 -24198 -1 -1; #X obj 100 294 f 10; #X obj 133 293 + 20; #X msg 144 269 10; #X obj 494 248 until; #X obj 435 150 bng 24 250 50 0 empty empty run_test 0 -6 0 8 -225271 -1 -1; #X floatatom 435 297 8 0 0 1 milliseconds - -; #X obj 435 182 t b b b; #X obj 435 243 t b b; #X obj 435 274 cputime; #X obj 494 274 s BANG; #X floatatom 531 206 5 0 0 0 - - -; #X obj 100 327 pack 0 s; #X obj 211 268 list; #X symbolatom 211 291 10 0 0 0 - - -; #X msg 100 348 obj 10 \$1 \$2; #X text 211 185 Which?; #X text 25 22 first select \, which and how many objects to create \, then create them in [pd bm] by pressing the big green bng. After that \, send the test data by the run_test-bng and watch the time it takes.; #X msg 212 211 b-calc; #X msg 211 231 e-calc; #X obj 494 226 f 10000; #X obj 100 244 f 100; #X msg 284 213 e-complex; #X msg 285 233 b-complex; #X connect 2 0 1 0; #X connect 3 0 7 0; #X connect 4 0 27 0; #X connect 4 1 2 0; #X connect 4 1 9 0; #X connect 5 0 27 1; #X connect 6 0 4 0; #X connect 7 0 8 0; #X connect 7 0 18 0; #X connect 8 0 7 1; #X connect 9 0 7 1; #X connect 10 0 16 0; #X connect 11 0 13 0; #X connect 13 0 14 0; #X connect 13 1 26 0; #X connect 13 2 14 0; #X connect 14 0 15 0; #X connect 14 1 15 1; #X connect 15 0 12 0; #X connect 17 0 26 1; #X connect 18 0 21 0; #X connect 19 0 20 0; #X connect 20 0 18 1; #X connect 21 0 1 0; #X connect 24 0 19 0; #X connect 25 0 19 0; #X connect 26 0 10 0; #X connect 27 0 3 0; #X connect 28 0 19 0; #X connect 29 0 19 0;
#N canvas 231 180 450 300 10; #X obj 97 54 r BANG; #X obj 97 135 f; #X obj 97 103 expr 1000/$f1; #X obj 97 80 f 12; #X connect 0 0 3 0; #X connect 2 0 1 0; #X connect 3 0 2 0;
#N canvas 384 267 450 300 10; #X obj 87 90 r BANG; #X obj 87 127 expr 12*(1+2+3+4+5+6+7+8+9+10); #X obj 87 158 f; #X connect 0 0 1 0; #X connect 1 0 2 0;
#N canvas 631 289 450 300 10; #X obj 143 191 f; #X obj 143 44 r BANG; #X obj 143 132 f 1000; #X obj 143 68 f 12; #X obj 143 97 t b a; #X obj 143 158 /; #X connect 1 0 3 0; #X connect 2 0 5 0; #X connect 3 0 4 0; #X connect 4 0 2 0; #X connect 4 1 5 1; #X connect 5 0 0 0;
#N canvas 0 0 450 300 10; #X obj 224 224 * 12; #X obj 144 88 f 1; #X obj 144 111 + 2; #X obj 154 121 + 3; #X obj 164 131 + 4; #X obj 174 141 + 5; #X obj 184 151 + 6; #X obj 196 160 + 7; #X obj 204 171 + 8; #X obj 215 181 + 9; #X obj 224 201 + 10; #X obj 144 58 r BANG; #X obj 222 244 f; #X connect 0 0 12 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 4 0 5 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 10 0 0 0; #X connect 11 0 1 0;
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
