Which is Faster? Python or C#/.NET?

--

Please note, that this is only one basic test of speed.

In software development, we have the languages that are interpreted when they are run or are compiled into native code. Overall, an interpreted language will normally be slower than a compiled language, as the code needs to be converted from high-level code to machine code as the program is run. But compiled programs can hog the processor and cause it to crash if it does not handle things correctly.

We thus have managed environments where the code is compiled to a near machine-ready version and then run within a managed environment. This managed environment makes sure that the code is run correctly and does not crash the system. Typical languages we have for this are Java and .NET/C#. Overall, C# is compiled into an CIL (Common Intermediate Language and previously known as Microsoft Intermediate Language) form as an EXE and when it is run in the .NET framework on the system. The CIL is then portable on a range of systems that support the .NET framework. Overall, the .NET framework is open source and will run on Windows, Mac OS and Linux.

With Python, we do not normally compile straight to machine code but will convert it into byte code ahead of the code running on the processor. The Python runtime engine will then convert this byte code into machine code when the program is…

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.