Benyamin Jafari
Benyamin Jafari

Reputation: 34056

Is there the difference between runtime of .py and .pyc files?

I know about .pyc files (compiled .py file) and difference between them:
difference between .py and .pyc


My question is:

Thanks in advance.


Upvotes: 0

Views: 564

Answers (2)

Vishnu Kiran
Vishnu Kiran

Reputation: 652

.pyc contains byte code which is essentially what the interpreter compiles the source code into.Generating byte code is essentially something that is done for optimisation by which way your code can be run directly without having to create an executable. This makes things faster.

Upvotes: 1

Benyamin Jafari
Benyamin Jafari

Reputation: 34056

I think when you run a .py file, it takes few time for creating its .pyc file.

And when you straight run .pyc file does not need to take a time for creating .pyc file and then runtime of .py and .pyc files are the same.

Upvotes: 0

Related Questions