Hi I've tried BioBlender on the sample data PDB file that included, and that is pretty neat.
I also notice that BioBlender is able to import large amount of objects (~2000+) proteins objects in a quite short amount of time (almost instant). Awesome!
So therefore I am here to ask about how to reduce the amount of time to import (create) objects into the original blender?
I have this project that we need to visualize our mammary gland simulation data in 3D, and we tried blender. I've developed some Python script that can read and parse our simulation data output, and create (cell) objects in blender according to there coordinates and some other parameters.
Since it's cell based, the amount of objects is gigantic. Reading in ~3000 cell objects require 5+ minutes already. And I tried reading ~15000+ cells in requires a day to finish...
I have a pretty powerful machine:
Intel Xeon 2.50GHz, qua-core, with 24GB memory, so the performance should be way better (by comparing my Python script to BioBlender)
Is there any tips that I can speed up the cell object creation in the original blender? We have way more cells than 15000+ to visualize, and taking a day to just load the data is just too long.
Your question, Charlie, is essentially "what foolish things am I doing?". Hard to say without seeing some code or docs. However...
BioBlender is Windows-only application which suggests they wrote some of the slow parts in C or another compiled language. Compiled languages are generally faster than interpreted languages. However...
Algorithms beat compilers. Example: doing a serial lookup through an ever-increasing mass of data will be slower than a dictionary or hash-table lookup.
Some general rules:
Creating new objects is expensive. Do not do it unnecessarily. This can be very important with dealing with strings. Strings in Python are immutable which means that building up strings by repeatedly appending onto the end creates a new string each time. String buffers and string i/o can be your friends here.
Use the language: a list comprehension is faster than a for loop because it executes compiled code rather than your interpreted loop code.
Python makes it fairly easy to write critical parts of your code in C or C++. You can then import these modules just like regular Python modules.
This comes in handy because code bottlenecks are one of those 80/20 things - 80 percent of the time is spent in 20 percent of the code. Either change that algorithm or recode it in C and you will get a nice speedup.
BioBlender is now available also for Linux and Mac users. Please download from www.BioBlender.org
, and let us know if it works OK for you!