sidebar features
sidebar content

Go Back   Blender Artists Forums > General Forums > Python & Plugins

Reply
 
Thread Tools
rocketship's Avatar
rocketship rocketship is offline
Member
 
Join Date: Apr 2006
Posts: 222
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:
CGkit Matrix*Matrix: cgkit took 0.163 minutes CGkit Vector*Matrix: cgkit took 0.191 minutes numarray Matrix*Matrix: numarray took 0.431 minutes numarray Vector*Matrix: numarray took 0.430 minutes Blender Matrix*Matrix: blender took 0.045 minutes blender Vector*Matrix: blender took 0.044 minutes
Blender beats numarray by almost a factor of 10! Even cgkit by a very respectable factor 3...
RS
............................................
http://severnclaystudio.wordpress.com
#1   Old 19-Oct-07, 19:44   
Reply With Quote


tedi tedi is offline
Member
 
Join Date: Jul 2002
Posts: 1,558
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   Old 19-Oct-07, 20:09   
Reply With Quote
osxrules's Avatar
osxrules osxrules is offline
Member
 
Join Date: Jun 2004
Location: Scotland
Posts: 3,944
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   Old 19-Oct-07, 22:51   
Reply With Quote
IanC IanC is offline
Member
 
Join Date: Jul 2002
Posts: 2,757
V interesting, thanks.

Have you tried comparing it to numeric?
............................................
Click here for options to turn sigs off.
#4   Old 20-Oct-07, 11:08   
Reply With Quote
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,421
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   Old 20-Oct-07, 17:41   
Reply With Quote
rocketship's Avatar
rocketship rocketship is offline
Member
 
Join Date: Apr 2006
Posts: 222
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   Old 20-Oct-07, 21:30   
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 11:36.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Logo and website design copyright © 2006 by froodee design bureau. All rights reserved.
Other Blender Sites
new icon Blender Homepage »
The official Blender homepage
new icon BlenderNation »
Fresh Blender News, Every Day
new icon Blenderart Magazine »
Blender articles, tutorials and images.
Blender Headlines
Featured Artwork
Short animation: Barrel by Phlopper
Woolly mammoth by sebastian_k
Photorealistic classic furniture by eMirage
Social BlenderArtists