• ### expr vs multiple objects which is faster and more efficient?

Hi, I would like to know which one is cpu-wise more efficient when calculating some complex equations.

Is it any beneficial to use one expr than using multiple [+] {-] {*} {/} ?

I know there won't be a huge difference but still I would like to know if one is better than another. only regarding the cpu efficiency.

• Posts 2 | Views 1239
• I have recently translated a Pd algo into an expr~ algo, and expr failed to be as efficient, or I failed (to translate it into sthg efficient). But, in general and for practical purposes, there's no difference between the two types.

I think that the most important thing is that the patch ends up being easy to understand. You can put everything into a formula and, more or less, the efficiency will probably be the same. But if you put everything into a single formula, then that formula becomes criptic, and difficult to change, or replace.

Combining Pd core math objects and expr family objects sems to be a good strategy. Part of being intelligent, is being able to create chunks of meaningful info. So a well designed patch should allow you to identify those chunks easily. You'll notice that a patch becomes easier to read if you combine both types.

Your question is relevant. However, there are other issues which are far more relevant than efficiency.

• 1st example, Pd built-in [/] operator:

[25 24(
|
[/]
|
[1.041)

• 2nd example, with expr:

[25 24(
|
[expr \$f1/\$f2]
|
[1.041)

• 3rd example, with expr:

[bang(
|
[expr 25/24]
|
[1 )

• 4th example, with expr:

[bang(
|
[expr 25./24] (notice the decimal point after the 25)
|
[1 .041)

And don't think that Pd and expr share the same philosophy as regards 0^0. (LOL^LOL).

• Pd:

[0 0(
|
[pow]
|
[0 )

• expr:

[0 0(
|
[expr pow(\$1, \$2)]
|
[1 )

Cordially, Landon

I live and love in Argentina

Posts 2 | Views 1239
Internal error.

Oops! Looks like something went wrong!