0

The python 3.5 documentation itself says:

  • A program doesn’t run any faster when it is read from a .pyc file than when it is read from a .py file; the only thing that’s faster about .pyc files is the speed with which they are loaded.

But looking up on my modules folders, most of '.pyc' files are bigger than its counterpart '.py' files.

1 Answers1

1

.pyc files are already known/assumed to be correct, complete Python files. As such they don't need to be fully lexed and parsed, they can just be loaded directly into the bytecode cache of the Python VM after a couple of perfunctory checks.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358