|
|||||||
![]() |
|
|
Thread Tools |
|
||||
|
I did a quick comparison of three math modules: cgkit, numarray (supposedly the "gold standard" of Python math) and Blender. The results were surprising (this is multiplying 100,000 random matrices):
Code:
RS
............................................
http://severnclaystudio.wordpress.com |
||||
|
#1
|
||||
|
|
|
|||
|
Wow somebody tell guido quickly to copypaste some nasty blender code into python
![]() Otoh I think there's no reason for blender not to get even faster. |
|||
|
#2
|
|
||||
|
Blender divides numbers by 10 at random so running the benchmark in Blender makes it seem 10 times faster when in fact they're about the same speed.
Just kidding, that's relating to the fact Blender divides its angles in the IPO window by 10 for some reason. I've always found the Py API to be pretty speedy compared to most plugin architectures including Maya's MEL scripting. It's actually one of the things that impresses me most about Blender and it's interesting to see after all these years that Maya is only just starting to use Python too. One thing I don't like about it is that when you put Blender into the background, Python scripts seem to go a lot slower. I don't know if it switches to some lower CPU background mode or something.
............................................
Pinky: Isn't life wonderful, Brain? Just think, we started out as lab mice forced to spend the whole day working our way through frustrating mazes that went absolutely nowhere. Now we get to do what humans do! |
||||
|
#3
|
|
|||
|
V interesting, thanks.
Have you tried comparing it to numeric?
............................................
Click here for options to turn sigs off. |
|||
|
#4
|
|
||||
|
Thanks for the benchmark! - nice to know blender is faster ;-) in the big picture this might not be that big a difference since its hard to know how much these operations would effect real world cases. but still nice.
a few people have suggested we replace mathutils with numarray, but for now Im happy not to. especially since we can have funcs that are more spesific to 3d apps built in to the API...( I know, we could subclass numarray.. :/ and add our own funcs... but thats work isnt it!)
............................................
BPython Cookbook * How to get features into Blender * Code Metrics Hire Me ideasman42<at>gmail.com |
||||
|
#5
|
|
||||
|
ideasman,
Actually, you *can't* subclass numarray - it has the same problem as Blender. I started to wonder when I saw the note under the dot product function in numarray saying "somebody who knows something about matrix multiplication should really do this properly one of these days". It may be really fast at higher-dimensional arrays, but its definately not optimized for matrices. Actually, if you could really subclass Blender classes, its not a bad little graphics toolkit. With the exception of the gaming-oriented toolkits (Ogre, Crystal3d) which seem to be very poorly documented, there's not much out there besides cgkit. RS
............................................
http://severnclaystudio.wordpress.com |
||||
|
#6
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|