Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can an implementation of a language in the same language be faster than the language?

If I make a JVM in Java, for example, is it possible to make the implementation I made actually faster than the original implementation I used to build this implementation, even though my implementation is built on top of the original implementation and may even be dependant on that implementation?

( Confusing... )

Look at PyPy. It's a JIT Compiler for Python made in Python. That's alright, but how can it claim to be faster than the original implementation of Python which it is using and is dependent on?

like image 311
ApprenticeHacker Avatar asked Feb 21 '12 14:02

ApprenticeHacker


People also ask

What makes a language faster?

The predominant characteristic that is considered to make a language fast is how well its data types correspond to machine data types. Java is considered to be an efficient language because it has primitive data types.

What makes a programming language faster than another?

Simple answer is, the closer a language is to the hardware the faster it would be. The more a language depends on libraries and other functions to do it's tasks the longer it takes for program execution in that language.

Why is it often quicker to develop software in an interpreted language?

Interpreted Language: One More StepBecause these languages don't need prior compilation, programs written in them are generally much easier to make and test. As a result however, the software itself can be significantly slower. Interpreters execute the source of a program line by line, which incurs a speed penalty.

What is the fastest processing language?

C++ is one of the most efficient and fastest languages. It is widely used by competitive programmers for its execution speed and Standard Template Libraries(STL).


1 Answers

You are confused between a language and the execution apparatus for that language.

One of the reasons why PyPy can be faster than CPython is because PyPy is compiled to a completely separate native executable, and does not depend on, nor execute in, CPython.

Nevertheless, it would be possible for an inefficient implementation of one language to be surpassed by an interpreter written in that same language, and hosted in the inefficient interpreter, if the higher-level interpreter made use of more efficient execution strategies.

like image 125
Marcin Avatar answered Nov 07 '22 10:11

Marcin