# Optimizing Expressions

**URL:** https://forum.highend3d.com/t/optimizing-expressions/2756
**Category:** Maya
**Tags:** mel
**Created:** [October 11, 2006, 10:08pm UTC](https://forum.highend3d.com/t/optimizing-expressions/2756 "2006-10-11T22:08:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![user\_deleted](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/u/35a633/32.png) [@user\_deleted](https://forum.highend3d.com/u/user_deleted)
#### Post date: [October 11, 2006, 10:08pm UTC](https://forum.highend3d.com/t/optimizing-expressions/2756/1 "2006-10-11T22:08:05Z")

</div>

have a big scene with lots of expressions and it's quite slow  
(I know mel and expressions are different so I hope this is the right thread)

I remember from my old days of coding in C when certain operations were "expensive" (multiplication and divisions were avoided whenever possible)... this was on 386 machines, is it still true with today's cpus?

if so what other commands should I stay away from?  
are clamp and linstep expensive fucntions for instance? I use them without restraint.  
if anyone knows, or can point me to any documentation that goes into this sort of thing, it would be great.

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [October 12, 2006, 7:02am UTC](https://forum.highend3d.com/t/optimizing-expressions/2756/2 "2006-10-12T07:02:49Z")

</div>

Delete all calls to setAttr and getAttr, combine nodes where plausible.

pure expressions are optimized. But in general its not worth to optimize them further since you cant gain much more.

---

<div class="post-metadata">

### Author: ![user\_deleted](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/u/35a633/32.png) [@user\_deleted](https://forum.highend3d.com/u/user_deleted)
#### Post date: [October 12, 2006, 8:02am UTC](https://forum.highend3d.com/t/optimizing-expressions/2756/3 "2006-10-12T08:02:01Z")

</div>

I've boiled it down to this:  
there are 30 expressions that are slowing things down A LOT. if you're willing to look I can post them... they all end with a multiplication by 100... could this be noticeable?  
not a single call to setAttr or getAttr...

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [October 12, 2006, 11:20am UTC](https://forum.highend3d.com/t/optimizing-expressions/2756/4 "2006-10-12T11:20:46Z")

</div>

sure send then to my to pirvate mailbox. Anyway its not necceserily the expression thats the bottleneck but the whole graph itself.
