Lua is faster than Fortran???

David Cournapeau cournape at gmail.com
Sun Jul 4 11:25:58 EDT 2010


On Mon, Jul 5, 2010 at 12:00 AM, D'Arcy J.M. Cain <darcy at druid.net> wrote:
> On Sun, 4 Jul 2010 23:46:10 +0900
> David Cournapeau <cournape at gmail.com> wrote:
>> On Sun, Jul 4, 2010 at 11:23 PM, D'Arcy J.M. Cain <darcy at druid.net> wrote:
>> > Which is 99% of the real-world applications if you factor out the code
>> > already written in C or other compiled languages.
>>
>> This may be true, but there are areas where the percentage is much
>> lower. Not everybody uses python for web development. You can be a
>> python fan, be reasonably competent in the language, and have good
>> reasons to wish for python to be one order of magnitude faster.
>
> I wish it was orders of magnitude faster for web development.  I'm just
> saying that places where we need compiled language speed that Python
> already has that in C.

Well, I wish I did not have to use C, then :) For example, as a
contributor to numpy, it bothers me at a fundamental level that so
much of numpy is in C.

Also, there are some cases where using C  for speed is very difficult,
because the marshalling cost almost entirely alleviate the speed
advantages - that means you have to write in C more than you
anticipated. Granted, those may be quite specific to scientific
applications, and cython already helps quite a fair bit in those
cases.

>
> But, as I said in the previous message, in the end it is up to you to
> write your own benchmark based on the operations you need and the usage
> patterns you predict that it will need as well.  If your application
> needs to calculate Pi to 100 places but only needs to do it once there
> is no need to include that in your benchmark a million times.

I would question the sanity of anyone choosing a language because it
can compute Pi to 100 places very quickly :) I am sure google search
would beat most languages if you count implementation + running time
anyway.

>
>> I find LUA quite interesting: instead of providing a language simple
>> to develop in, it focuses heavily on implementation simplicity. Maybe
>> that's the reason why it could be done at all by a single person.
>
> Is that really true about LUA?  I haven't looked that closely at it but
> that paragraph probably turned off most people on this list to LUA.

I hope I did not turn anyone off - but it is definitely not the same
set of tradeoff as python. LUA runtime is way below 1 Mb, for example,
which is one reason why it is so popular for video games. The
following presentation gives a good overview (by LUA creator):

http://www.stanford.edu/class/ee380/Abstracts/100310-slides.pdf

To go back to the original topic: a good example is numeric types. In
python, you have many different numerical types with different
semantics. In LUA, it is much simpler. This makes implementation
simpler, and some aggressive optimizations very effective. The fact
that a LUA interpreter can fit in L1 is  quite impressive.

David



More information about the Python-list mailing list