![]() |
|||||||||||||
News | Tutorials | Games | Downloads | Links | Contact |
![]() |
![]() |
|
![]() |
||||||
Featured Author: ![]() -blendenzo-
|
Tutorials - Blender Game Engine
Python vs. Logic Bricksby blendenzoThere's a rumor that goes around in the BGE community that Python scripts are faster than Logic Bricks. This never made sense to me, since Logic Bricks are coded in C++, which is a lower level programming language than Python, meaning that (in theory) they should require slightly less processing time than Python scripts. Not being satisfied with my theories or the claims of others, I decided to do a simple test to see if Python is always faster than Logic Bricks. I set up two identical files, one using Logic Bricks, the other using Python. The two files are both laid out efficiently, and the Logic Bricks and Python are exact copies of each other functionally speaking. The Test Files LogicVersusPython.zip (57KB) I ran both files multiple times and monitored the "Logic" percentage in the profile data. (Note: Since Python scripts run through a Logic Brick, their processor usage is lumped into the Logic percentage in the profile data.) My Findings In such a simple application as this, there is no noticeable speed difference between the two solutions. If anything, the Python solution is very slightly slower in general, though the Logic Brick solution is more likely to sporadically jump to a higher percentage. Points of Interest In deciding which solution to use, you may find these observations useful:
My Conclusion While it may be true that Python is faster than Logic Bricks in some cases, the broad and sweeping claim that "Python is faster than Logic Bricks" cannot be supported in all cases, so it is (logically speaking) a false statement. -blendenzo Back to the tutorials index... |
|||||
|
||||||
![]() |
||||||
Website design by Tony "blendenzo" DiRienzo. All content © Copyright Tony DiRienzo unless otherwise noted.