Comments (6)
Thanks for reporting this. I'm glad you consider the performance impact of your suggestions. :)
What I would suggest is that you profile the change, before and after, identify what the cost is and if it's "too much" then we could find a way to work with that; e.g. either make it optional, or add a stern warning in the documentation.
To profile things like this, have a look at plot.py for inspiration.
from cmdx.
looks like it's safe. i ran several loops of 20000 parent commands and the difference between with or without is notable but still very small (about 50ms vs 200ms for each packet)
from cmdx.
If you can fit your test in plot.py
, ideally using a similar/same convention, then that would be swell. Then you could make a note of how long it takes along that line, for anyone looking at this in the future wondering how costly that is. You'll find similar notes across the code, in a μs
unit, for microseconds.
from cmdx.
hmm ok i see! here are more serious results (: is that what you had in mind?
New()
root1 = cmdx.createNode("transform")
root2 = cmdx.createNode("transform")
child = cmdx.createNode("transform", parent=root2)
melparent = 'parent -r "transform3" "transform1"; parent -r "transform3" "transform2";'
Test("mel", "parent", lambda: mel.eval(melparent), number=1, repeat=1000)
Test("cmds", "parent", lambda: [cmds.parent("transform3", parent, r=1) for parent in ("transform1", "transform2")], number=1, repeat=1000)
Test("cmdx", "parent", lambda: [cmdx.parent(child, parent) for parent in (root1, root2)], number=1, repeat=1000)
Test("cmdx safe", "parent", lambda: [cmdx.parent(child, parent, safe=True) for parent in (root1, root2)], number=1, repeat=1000)
root1, root2, child = pm.ls(map(str, (root1, root2, child)))
Test("PyMEL", "parent", lambda: [pm.parent(child, parent, r=1) for parent in (root1, root2)], number=1, repeat=1000)
parent mel: 115.5 ms (109.30 µs/call)
parent cmds: 119.1 ms (114.50 µs/call)
parent cmdx: 11.1 ms (10.60 µs/call)
parent cmdx safe: 19.3 ms (18.30 µs/call)
parent PyMEL: 601.7 ms (583.70 µs/call)
it looks like adding this security costs about twice the original command. still way cheaper than mel/cmds though
from cmdx.
Oh you are a star. :D Thanks for putting a smile on my face.
Yes, that is exactly what I had in mind. That safe=
option is great, we could leave that in, and default it to True
. That way, anyone wanting to squeeze performance could toggle that flag, and they'd be good to go.
from cmdx.
Implemented in #24. Thanks @wougzy!
from cmdx.
Related Issues (20)
- cmdx.listRelatives always returns None HOT 18
- Plugs not taking and returning UI units HOT 4
- Modifiers and data types HOT 2
- design proposition for components HOT 10
- attributes' default value not saved in scene HOT 3
- Support for proxy attributes
- DGModifier.disconnect and Undo
- Attribute reuse and undo
- Multiple versions simultaneously
- How to debug Maya crashes? HOT 9
- Deploy on CI HOT 1
- Direct passing of cmdx.Node to vanilla cmds HOT 3
- Support keyframing of pairBlended attributes
- MObjectHandle hashCode... HOT 3
- Two users, one machine
- Thoughts on code formatter such as Black? HOT 5
- Set a nodes transform HOT 7
- Auto offset group
- Add type annotations HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cmdx.