compiler


(IngieBee) #1

Does Blender compile the programs? or read them line by line? I was wondering if using a compiler would speed the execution of the scripts. Especially if they get really involved and long… can they be modular? Do I make any sense? LOL

Sorry, my computer vocab is bad (as is my vocab in general :wink: )

Thanks
Ingie


(theeth) #2

Internally, the Python interpreter (and Blender byt the same occasion) compiles modules when importing them. So, if your modules are already compiled, it only makes loading faster (a lot faster, if the modules are big).

Martin


(IngieBee) #3

Please verify that I understand, LOL. If I have a py script, and I import it into Blender, it becomes compiled. Likewise, I can have it pre-compiled via a py interpreter, and that would eliminate the need for Blender to compile it, making loading faster.

Is that right? LOL so sorry, but the programming lingo sometimes makes me confused.

Does it matter which python compiler you use? or is output very standard and always recignized by Blender?

Also, I was viewing the “Parade” file on my work desktop, and they went kind of slow. Would that be due to the cheaper/older video card? This has a pretty good processer. 1.5 gig processer and 256 memory (gee, why do I get such a nice one? LOL) I don’t remember running the annimation at home, and right now… well my computer is sick, lol.

So would my gforce make it faster?

Thanks for the info, Love Ingie


(theeth) #4

If I have a py script, and I import it into Blender, it becomes compiled. Likewise, I can have it pre-compiled via a py interpreter, and that would eliminate the need for Blender to compile it, making loading faster.
Exactly. The execution of the script (in itself) is not faster. Only the loading time.

Does it matter which python compiler you use? or is output very standard and always recignized by Blender?

It doesn’t matter really, even the Python command line can compile them, just by importing the modules. While it might returns errors (if you use the Blender module, for example), the .pyc file generated while always be correct.

There is 2 types of compiled Python files: PYC and PYO. Both are compiled binaries, but the PYO compilation method removes the comments (and docstrings I think. Not sure about docstrings though).

If you want to compile many modules at once, I suggest you use the compileall.py script which is distributed with the Python distro.

I hope that was clear.

Martin


(IngieBee) #5

Yes, very much so, thanks so much.

Love Ingie