LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-20-2006, 06:16 AM   #1
amolgupta
Member
 
Registered: Feb 2005
Location: agra,india
Distribution: FC2
Posts: 158

Rep: Reputation: 30
are inter preted programs slower and is python interpreted


are interpreted programs slower and is python interpreted
or let me put it this way is python application slower than other compled languages
bcos i feel yum is slower than apt
 
Old 07-20-2006, 08:08 AM   #2
Stephen Wilson
LQ Newbie
 
Registered: Jan 2006
Location: Kingsville, Melbourne, Australia.
Distribution: Debian
Posts: 5

Rep: Reputation: 0
Python is interpreted and as such will run slower than a compiled source.
 
Old 07-20-2006, 08:48 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,287

Rep: Reputation: 173Reputation: 173
sort of by definition but not neccecelery in practice.

It depends on lots of things, how well programmed it is for a start.

I have found (with perl) that it will run as near as dammit as fast as C.
In fact, I found C was faster only when I didn't put safety checks in on
file reads and what not, which perl has automatically.
 
Old 07-20-2006, 09:21 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,491

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
You can't beat assembly language when the unique metric is speed.

However, ease of development, portability, readability, maintainability, debuggability, developer skills are other elements that usually balance the choice toward other languages, like C, C++, Java, PHP, Python and the likes.
 
Old 07-20-2006, 10:46 AM   #5
amolgupta
Member
 
Registered: Feb 2005
Location: agra,india
Distribution: FC2
Posts: 158

Original Poster
Rep: Reputation: 30
thanx alot
 
Old 07-20-2006, 11:32 AM   #6
jayemef
Member
 
Registered: Aug 2005
Location: Juniata College, PA
Distribution: Ubuntu, Slackware
Posts: 67

Rep: Reputation: 15
Quote:
Originally Posted by amolgupta
bcos i feel yum is slower than apt
This has more to do with repositories and the differences between how yum and apt work than any differences in language.
 
Old 07-20-2006, 12:42 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by jlliagre
You can't beat assembly language when the unique metric is speed.
Nowadays, its really hard to make assembly programs that outperform the optimized assembly generated by a compiler. You'd have to memorize many processor-specific instructions and know which of many options to chose from.

You could always hand-tweak a compiler-generated assembly file .
 
Old 07-20-2006, 01:29 PM   #8
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
Quote:
Originally Posted by osor
Nowadays, its really hard to make assembly programs that outperform the optimized assembly generated by a compiler.
I've seen people make this statement in a few places, but I find it difficult to believe. I'd like to know on what basis it's being said and with respect to exactly which compilers/assemblers/platforms. Could it be that people are just repeating what they've read? Or does someone have personal knowledge of this?

Quote:
Originally Posted by osor
You'd have to memorize many processor-specific instructions and know which of many options to chose from.
So do the guys writing the compilers. At the end of the day, a person is still "writing the assembler code" because a person (or people) wrote the compiler.

And so do good assembler programmers. They read the processor manuals continually, learn their hardware, and test to see what works best.

If, on the other hand we're comparing the output of a good optimizing compiler to the output of a mediocre assembler programmer, the outcome shouldn't surprise anybody.

Quote:
Originally Posted by osor
You could always hand-tweak a compiler-generated assembly file .
This sounds like mostly a waste of time unless you have a very good optimizing compiler for a very high level language doing some very specialized types of things for which the team who wrote the compiler knows better and more effective algorithms than the "human" competitor. But this is certainly a possible scenario.

Last edited by Randux; 07-20-2006 at 01:30 PM.
 
Old 07-21-2006, 08:50 AM   #9
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
any language and api are there for a purpose , i think the slowness or the "intensity" of any things are not that important ... they usually serve the long-term purpose well enough ... its silly enough for a windows user to ask for a complete set of commandline flexibilities while linux is able to have complete set of both worlds , sometimes i would like to think that stuffs like these are really actually build for the linux world ...




.
 
Old 07-22-2006, 12:20 AM   #10
urzumph
Member
 
Registered: Jan 2004
Location: Australia
Distribution: Debian
Posts: 168

Rep: Reputation: 30
In the most literal sense, compiled code is faster than interpreted code (or byte code compiled code, like java), however, there are many other factors which affect the execution speed - Hard disk usage, communication with external hardware (eg, via serial cable) and network communication. On most programs, except perhaps for some very computation heavy projects (eg, scientific research, brute force algorithms, etc) are going to spend more time waiting for the HDD or network than waiting for the CPU to work.
 
Old 07-22-2006, 03:38 AM   #11
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
Compilers generate assembly? Wow, this is a new one. I was under the impression that one wrote code in assembly (which is human readable) and then it was compiled into machine language. Sorry, I just had to pick that nit!

Seriously though - more than anything else it's the architecture and implementation that will affect performance. You can write really sloppy assembly and clean C, and the C can vastly outperform the sloppy assembly routine. YMMV, batteries not included, etc.
 
Old 07-22-2006, 04:27 AM   #12
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 48
Quote:
Originally Posted by KimVette
Compilers generate assembly? Wow, this is a new one.
Yes they do (see gcc -S); in fact that's what's properly called compilation.
Quote:
Originally Posted by KimVette
I was under the impression that one wrote code in assembly (which is human readable) and then it was compiled into machine language.
That's called the assembler.
 
Old 07-22-2006, 05:45 AM   #13
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by KimVette
Compilers generate assembly? Wow, this is a new one. I was under the impression that one wrote code in assembly (which is human readable) and then it was compiled into machine language.
That's strange. I was under the impression that coders wrote code in assembly language, a higher level language, or a scripting language. (Or under extreme circumstances or with a very deranged coder, directly in machine language!) Assemblers then assembled, script interpreters then interpreted, and compilers compiled, either to assembly language or directly to machine language (making allowance for relocatable modules where not everything has been resolved yet) depending on the compiler (ah, Motorola MPL, we barely knew ya) or possibly options.

(Ah, this "philosiphising" is a nice break from cold hard technical problems! )

Last edited by blackhole54; 07-22-2006 at 05:47 AM.
 
Old 07-22-2006, 09:17 AM   #14
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
what is this assembly code you speak of.. is that something like visual basic?
 
Old 07-22-2006, 09:31 AM   #15
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,491

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Quote:
Originally Posted by xhi
what is this assembly code you speak of.. is that something like visual basic?
Vaguely, both are a more or less unreadable suite of instructions ...
 
  


Reply

Tags
python


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What do you use to develop python programs? stormrider_may Programming 2 03-11-2006 02:29 PM
LXer: Embedding Python in Your C Programs LXer Syndicated Linux News 0 12-31-2005 10:31 AM
Php is not getting interpreted? swatward Programming 1 07-31-2005 03:48 PM
HTML not interpreted os2 Programming 1 04-29-2005 05:00 PM
Freezing Python Card programs Hal Programming 1 04-11-2005 04:59 AM


All times are GMT -5. The time now is 06:57 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration