Computer Language Shootout
We don't have Python implementations for one program, and a couple of the Python programs we do have show Error. http://shootout.alioth.debian.org/benchmark.php?test=all&lang=python&lang2=python Please contribute missing Python programs or faster more-elegant Python programs. Please follow the FAQ instructions http://shootout.alioth.debian.org/faq.php#contribute best wishes, Isaac -- http://mail.python.org/mailman/listinfo/python-list
Re: Computer Language Shootout
We don't scrape programs from news-groups, if you'd like the program to be shown on the shootout then please attach the source code to a tracker item. Please follow the FAQ instructions http://shootout.alioth.debian.org/faq.php#contribute [EMAIL PROTECTED] wrote: > This is a direct translation of the D code, maybe it's not the faster > Python implementation, and surely it's not the shorter one. But Psyco > makes it much faster (Psyco likes "low level" style code). > ShedSkink is (almost) able to compile it too, producing a really fast > executable (with some "smart attentions" this SS version becomes only > 17% slower than the D version for a given n=11 (26.66 sec instead of > 22.70 sec of total running time on a PIII 500 MHz)). > > > ! import sys > ! > ! def fannkuch(n): > ! perm = [0] * n > ! perm1 = range(n) > ! count = [0] * n > ! m = n - 1 > ! r = n > ! maxFlipsCount = 0 > ! > ! while True: > ! while r != 1: > ! count[r-1] = r > ! r -= 1 > ! > ! # SS v.0.0.5 has a problem with this line: > ! if not (perm1[0]==0 or perm1[m]==m): > ! #perm = list(perm1) > ! # to not produce memory garbage > ! for i in xrange(n): > ! perm[i] = perm1[i] > ! > ! i = perm[0] > ! flips = 0 > ! while i: > ! temp = perm[i] > ! perm[i] = i > ! i = temp > ! j = 1 > ! k = i - 1 > ! while j < k: > ! temp = perm[j] > ! perm[j] = perm[k] > ! perm[k] = temp > ! j += 1 > ! k -= 1 > ! flips += 1 > ! > ! if flips > maxFlipsCount: > ! maxFlipsCount = flips > ! > ! while True: > ! if r == n: > ! return maxFlipsCount > ! temp = perm1[0] > ! i = 0 > ! while i < r: > ! j = i + 1 > ! perm1[i] = perm1[j] > ! i = j > ! perm1[r] = temp > ! > ! count[r] -= 1 > ! if count[r] > 0: > ! break > ! r += 1 > ! > ! > ! #import psyco > ! #psyco.bind(fannkuch) > ! > ! if len(sys.argv) > 1: > ! n = int(sys.argv[1]) > ! else: > ! n = 1 > ! print "Pfannkuchen(%d) = %ld" % (n, fannkuch(n)) > > > Bye, > bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: Computer Language Shootout
[EMAIL PROTECTED] wrote: > Bengt Richter wrote: > > On 29 Nov 2005 14:08:12 -0800, [EMAIL PROTECTED] wrote: > > > > >We don't scrape programs from news-groups, if you'd like the program to > > >be shown on the shootout then please attach the source code to a > > >tracker item. > > You asked for something, got a response, and then you haughtily[1] declare > > that it's not being served on a special platter from your cupboard, > > and you won't deign to "scrape" the serving onto your own platter. > > Pfui. Your apparent[1] attitude turns me off, not to mention your > > top-posting. > > > I don't see it as an attitude issue but wording. It is blunt but I can > see his point. He was asking people if it is possible to > submit(contribute) some code to the test. And based on what I saw on > his site, it is inappropriate for him to just take code from ML/usenet > as all codes there need proper author(beyond courtesy, there may be > copyright issue). That is my reading anyway. That is correct, we publish an author's work under Revised BSD - we can't just take a program from a newsgroup. > > If it was nicely explained why it needs to be done this way upfront(or > in the response), I believe you may not feel it this way. > > Interestingly, I find this response quite compatible with the > personality of this group. -- http://mail.python.org/mailman/listinfo/python-list
Re: Computer Language Shootout
[EMAIL PROTECTED] wrote: > This is a direct translation of the D code, maybe it's not the faster > Python implementation, and surely it's not the shorter one. But Psyco > makes it much faster (Psyco likes "low level" style code). And if you contributed the program like this http://shootout.alioth.debian.org/gp4/faq.php#contribute we could run the program with Psyco http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=psyco&lang2=python best wishes, Isaac -- http://mail.python.org/mailman/listinfo/python-list
Re: Computer Language Shootout
Fredrik Lundh wrote: > Bengt Richter wrote: > > > That's not just blunt and concise, it looks like the modus operandi > > of a typical volunteer/employee-exploiter (or perhaps spoiled brat, > > the typical precursor to the former). > > careful. his faq requires you to "be nice". > > "Be Nice!" *is* one of paragraph headings in the FAQ section "How can I help?" imo Saying that the FAQ "requires you to "be nice" is a misrepresentation. -- http://mail.python.org/mailman/listinfo/python-list
Re: python speed
Paul Boddie wrote: > Steven Bethard wrote: > > David Rasmussen wrote: > > Faster than assembly? LOL... :) > > > Faster than physics? ;-) > > > I think the claim goes something along the lines of "assembly is so > hard > > to get right that if you can automatically generate it from a HLL, > not > > only will it be more likely to be correct, it will be more likely to > be > > fast because the code generator can provide the appropriate > optimizations". > > > I think this is just a restatement of existing motivations for using > high-level languages and compilers. My impression is that PyPy takes > inspiration from work which showed that run-time knowledge can > sometimes produce code that is better optimised than that produced by > a > compiler. > > That said, when everyone starts showing off their favourite > benchmarks, > it might be more interesting not to parade some festival of arithmetic > yet again. Where more recent versions of the Java virtual machines > have > improved is in their handling of object memory allocation, amongst > other things, and merely scoffing that Java is slow (by pulling > specific/specialised extension packages out of the hat) fails to > acknowledge the potential for similar improvements (and others) in > Python, especially where programs involving plain objects - as opposed > to numbers, and where no conveniently available and wrapped C/C++ > package exists for the task - are concerned. > > Paul For example, binary trees http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&lang=all -- http://mail.python.org/mailman/listinfo/python-list
Re: survey
> The Language Shootout at http://shootout.alioth.debian.org/ has code > samples in many languages, both interpreted and compiled, including the > ones you mentioned. Don't trust the lines-of-code statistics, though -- > the LOC measure is wrongly shown as zero for several codes, and comment > lines are counted, so that languages with programmers who use more > comments are penalized. afaik the LOC measure does not count comment lines - is there a specific example? Anyway, we continue to add new micro-benchmarks and deprecate old ones. We really welcome program contributions for the new and old tests - so send us some Python! -- http://mail.python.org/mailman/listinfo/python-list
Re: code for Computer Language Shootout
We've made it somewhat easier to contribute programs. No need to subscribe to the mailing-list. No need for a user-id or login. See the FAQ "How can I contribute a program?" http://shootout.alioth.debian.org/faq.php -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python appropriate for web applications?
> > How about the speed of execution? > > There is no simple answer. Both languages use C functions which are > executed at CPU speed. But with interpreted code Python seems to be > approximately 3-4 times faster than PHP (http://dada.perl.it/shootout/). The Win32 Computer Language Shootout hasn't been updated for 22 months. The Great Computer Language Shootout Benchmarks were updated 2 days ago http://shootout.alioth.debian.org/great/ For those original Doug Bagley tests click on "The Doug Bagley" -- http://mail.python.org/mailman/listinfo/python-list
Re: n-body problem at shootout.alioth.debian.org
Peter Maas wrote: > Paul McGuire wrote: > > The advance method is the most fertile place for optimization, since it is > > called approximately n(n-1)/2 times (where n=2E7). I was able to trim about > > 25% from the Python runtime with these changes: > [...] > > My results: > > Your changes: 18% runtime decrease > Your changes + objects->lists: 25% runtime decrease > > The Python program is much closer to the Perl program then (~2250 vs 1900 sec) > but replacing the objects by lists is not worth the effort because the gain is > small and the Python program becomes less readable. > > Taking arrays (from module array) instead of lists increases runtime by 19%! > > If it weren't for the shootout I would of course take psyco and numpy. > > -- > Regards/Gruesse, > > Peter Maas, Aachen > E-mail 'cGV0ZXIubWFhc0B1dGlsb2cuZGU=\n'.decode('base64') We can have our Python and Psyco too :-) http://shootout.alioth.debian.org/gp4sandbox/fulldata.php?test=nbody&p1=python-0&p2=psyco-4&p3=iron-0&p4=psyco-3 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs. Lisp -- please explain
Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > "Chris Mellon" <[EMAIL PROTECTED]> wrote: > ... > > They won't say Java. Ask them why Python is interpreted and Java isn't > > and you'll have a hard time getting a decent technical answer, because > > Python isn't all that different from Java in that regard, especially > > pre-JIT versions of Java. > > For me that would be partly because I don't know that > much about Java, honestly. Just searching at random > for something about the subject, I cam across this - > http://www-128.ibm.com/developerworks/java/library/j-native.html?loc=j > - which seems like it might be of some interest here. > > My impression from reading this is that Java actually > can be compiled to native code, though in 2002 this > was relatively new. > >Donn Cave, [EMAIL PROTECTED] Excelsior Jet ahead-of-time (AOT) compiler FAQ "How does it work from the technical point of view?" http://www.excelsior-usa.com/jetfaq.html#internals -- http://mail.python.org/mailman/listinfo/python-list
Re: Is python very slow compared to C
Magnus Lycka wrote: > Isaac Gouy wrote: > >>I think it is wrong to call Python "very slow" just because it is slower > >>than some other language or languages, for the same reason it would be > >>wrong to describe the population of the UK as "very low" because 60 > >>million people is a smaller number than China or India's one billion plus. > >>Doing so merely reinforces the premature optimizer's message that any > >>language that isn't C (and sometimes Lisp) is "not fast enough". > > > > There was some context: Is python very slow compared to C? > > But that is a stupid context. It doesn't really tell us > anything. Slow at what? As I said: We can make /the missing context/ in the OP's question more obvious... > > No one writes a program for the purpose of doing loops, > comparing integers, setting up stack frames or jumping > between instructions. > > The context for programming typically involves solving some > problem or executing a function that matters to the user. > > It's just as database benchmarks. TPC C benchmarks tells us > how fast a certain database is at performing TPC C benchmarks. > Does that tell you anything about how fast it will be compared > to competing products for your real world problem? Probably > not. Which ever product you choose, you might end up with > situations where a particular function is too slow. You can > typically solve this either by changing the code or the > configuration of the server. Sometimes you have to rethink > your system and solve the problem in another way. Changing > from e.g. DB2 to Oracle is unlikely to have more impact than > these smaller changes. It's the same thing with most software > development. > > >> The benchmark you pointed to are of limited use for application > >> developers. (Their value to language designers is another story.) > > > > Limited use for what purpose? > > They are more or less useless for anyone who wants to decide > what programming language to use in a real world situation. Good that's more explicit. One of the program contributors told me they do something quite similar to fasta, k-nucleotide and reverse-complement in their real world situation. Isn't it possible that someone would look through The Computer Language Shootout programs and decide that language X was unusable convoluted gobbledegook? > It's simply stupid to implement sorting algorithms in Python. > It's there already. Solving Ackermann's is also rather far > from what people typically want to achieve. What "sorting algorithm" are you talking about? There isn't one on http://shootout.alioth.debian.org/gp4/ Solving Ackermann's? Well if that was really the point then the programs would be allowed to use memoization rather than simple recursion. > If people actually > had the time and resources to create real software products, > (i.e. things that take man-months to create) from the same > spec, and developed e.g. ten programs each each ten different > programming languages in cleanroom conditions, we'd probably > learn something useful about the usefulness of a certain type > of programs with certain programming languages in certain > conditions, but only in these conditions. I'm rather certain > that aspects such as team size, development methodology etc > will influence the relative ratings of programs. > > I'm not saying that the typical toy benchmarks are completely > useless. They might tell us things about particular language > features that should be improved, or give us clues that a > certain way of solving a particular problem etc, but they > don't really help Joe Newbie Programmer who wants to write > yet another web site toolkit. -- http://mail.python.org/mailman/listinfo/python-list