Compiled languages like C++ and Go transform source code into machine code using a compiler before execution. The compiled machine code can then be directly executed by the CPU.
Java first compiles source code into bytecode, which is platform-independent and executed by the Java Virtual Machine (JVM). The JVM can further boost performance using Just-In-Time (JIT) compilation to convert bytecode to machine code at runtime.
Interpreted languages like Javascript and Ruby don't undergo compilation. Instead, their code is processed line-by-line by an interpreter during execution. However, modern JavaScript engines like V8 also utilize JIT compilation for enhanced performance.
Python is a mix of both worlds. It first compiles source code into platform-independent bytecode, which is then executed line-by-line by the platform-dependent interpreter. In addition, implementations like PyPy use JIT compilation for a speed boost.
Generally, compiled languages can offer speed advantages, but the line between compiled and interpreted languages is increasingly blurred thanks to modern optimization techniques.