I meant the runtime execution not the development time
|
Anyway, to save you the time of checking out other threads on this forum and what not others, I'll make a long story short:
Python > Perl. [Joking!.. well.. not to say it's not.] |
Definitely Perl.
First of all - much faster. You can prove it yourself by writing some classic test and comparing the results. You can also find comparisons in the Internet. |
Quote:
http://shootout.alioth.debian.org/gp4/python.php These examples are scientific in nature, and come the closest to being 'practical' benchmarks. And it really doesn't seem to support you're argument, "much faster". Outside of a few suspicpious spikes, they really seem comparable Removing the two largest deviations n-body test(which neither languages did a particularly good job on). fasta(python executes 1.5 fasters but uses 10.9x the memory) Python has 19 instances of being 'x' faster whereas perl has 19 instances. averaging the speeds on x faster. Python was 1.8 whereas perl was 1.873684211. The only 2 benchmarks that place perl dramatically ahead of python where the same benchmarks that proved either language was impractical if speed was the primary concern. Besides if you chose either, python or perl, chances are the speed of execution is not on the top of your concern list. If it is though, and you really want the fastest interpreter, you must ask yourself this question. Is perl's minute speed advantage worth dealing with its idosyncrasies? Are you going to like the way it looks, after realising a few months later you need to make some changes. |
How about this benchmark http://furryland.org/~mikec/bench/
|
Quote:
This page is outdated, ran by one person, no longer maintained and some of the results are clearly erroneous. for example the console test is waaaaaaaaaay off. simple verification(i'm assuming this is what the author did as well) time perl console.pl >> /dev/null real 0m1.580s time python console.pl >>/dev/null real 0m3.295s this test shows, atleast on my computer, perl leading by a whopping two seconds. I got similar results with i/o real 0m1.865s perl real 0m3.461s python The "speed" test shows the interpreters being near identical in speed on my computer. In the self-deprecating intro paragraph, the author even admits these are flawed benchmarks. Plus this all without compiling the python script to intermediate code and using the pysco module. You've been misinformed about perl, I believe. It does not have any significant speed advantages over python. |
For the console test,
if i change the python code to Code:
x = 0 Code:
$x=0; output Code:
what are your views? |
Quote:
(except in relation to not having it). I guess that sound extremely biased, but that is just my experience. Quote:
Quote:
|
Python is simple, easier but slower. If speed isn't a concern, I suggest Python. I am starting to learn Perl as well. It is good to learn how to read it as lots of people are written in Perl. I am converting few applications from Java to Python in the meantime : enough libraries to develop with, simple to use + to maintain.
When your program requires lots of performance(graphics drawing, etc.) and runtime speed/processing is the main concern, use C or C++, not Java, Python, Perl, etc. |
A simple benchmark shows that pure C is faster. For the other languages it depends on how you code it, compile it(optimisations flags), if you run precompiled code, etc.
Code:
mrcheeks:~/Tests/Perl> time $cwd/test.pl Code:
#include <stdio.h> Code:
#include <iostream> Code:
#!/usr/bin/env perl Code:
#!/usr/bin/python Code:
public class test{ |
As a final note...
Being a python programmer in industry for testing aerospace equipment, I found that python is merely precompiled C libraries where upon execution, byte-code is generated the first time through and subsequent runs are just that much faster. If speed is an issue one must eliminate the abstracted interpreter layer and work at the os level and using compiled native code. Python excels for time-to-market coding speed and extensibility via custom package creation. I believe I read a post that python lacks libraries which is hardly the case. It actually has available, quite an array of packages that allow a programmer to interface to all types of databases, applications etc. Love the neat coding standard of indenting since I've seen such horid coding practices which are not permitted in python. These are all good things that make it easier and less risky to implement. You can also build a windows executable out of your python scripts and run them like a native program.
|
Quote:
|
hehehe.... I must have been tired. .... I meant programs...
|
mrcheeks
Quote:
|
Python and perl are both good languages. I was writing text-processing utilities in C because I was familiar with it, but then I decided I'd try perl since it's designed for the tasks I'm doing. It's working out very well. I could've gone with python, too, and in fact it was a close decision.
It's true that perl code can be baroque and opaque, but it doesn't have to be. I think it's also true that it's easy to get started with perl and difficult to master it. For someone just wanting to learn a language for it's own sake, I'd recommend python. But with perl, if you have a task at hand that's well-represented in CPAN, you have the advantage of having a lot of your work already done by experts. So, as usual in questions like this, it depends on tastes and specifics. |
All times are GMT -5. The time now is 08:35 AM. |