Re: improving python performance by extension module (64bit)
On Sat, Jun 26, 2010 at 7:11 AM, Nobody wrote: > On Fri, 25 Jun 2010 20:08:27 -0400, geremy condra wrote: > >> I have written Haskell that runs faster than C, and Forth that runs >> faster than C, > > Faster than *what* C, though? Well, than the C it was replacing, which is admittedly not much of a claim. Having said that, it's a claim I can't make about Python, which was why I brought it up in the first place. > With Haskell, there's seldom a significant performance hit for using > -fvia-C, so you would probably have been able to get comparable > performance using C. Probably eventually, but not without some fairly substantial work on a section of code that was already pretty fast. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On Fri, 25 Jun 2010 20:08:27 -0400, geremy condra wrote: > I have written Haskell that runs faster than C, and Forth that runs > faster than C, Faster than *what* C, though? With Haskell, there's seldom a significant performance hit for using -fvia-C, so you would probably have been able to get comparable performance using C. The most common reason for Haskell to outperform C is due to lazy evaluation, i.e. the C code evaluates things which it doesn't actually need to. -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On Fri, Jun 25, 2010 at 6:18 PM, Mark Lawrence wrote: > On 25/06/2010 22:25, Stephen Hansen wrote: >> >> On Fri, Jun 25, 2010 at 1:51 PM, Mark >> Lawrencewrote: >> >>> On 25/06/2010 16:34, Stephen Hansen wrote: >>> >>> Python's slow, sure. But its in practice fast enough for an extremely broad range of activities. >>> What? >>> >> >> What, what? >> >> --S >> >> > > Python is *NOT* slow, you can develop software in it much faster than you > can in some other languages. The run time speed has also been shown to be > faster in some circumstance than C because of the Bots who're smart enough > to optimise it up to the hilt. CPython is written in C. By definition it cannot go faster than C, and extensive practice bears this out- the stdlib is full of modules either written or rewritten in C for speed, not to mention numpy, sage, etc. I'd also like to see the example you cite- I have written Haskell that runs faster than C, and Forth that runs faster than C, and I consider myself reasonably proficient at Python and have *never* seen Python code that executes faster than comparably optimized C. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On Fri, Jun 25, 2010 at 3:18 PM, Mark Lawrence wrote: > On 25/06/2010 22:25, Stephen Hansen wrote: > >> On Fri, Jun 25, 2010 at 1:51 PM, Mark Lawrence> >wrote: >> >> On 25/06/2010 16:34, Stephen Hansen wrote: >>> >>> Python's slow, sure. But its in practice fast enough for an extremely >>> broad range of activities. >>> What? >> >> What, what? > > Python is *NOT* slow, you can develop software in it much faster than you > can in some other languages. Python is a very programmer-productive language, yes. It's still slow, though. Me being able to develop fast in it doesn't make the language itself fast or slow. > The run time speed has also been shown to be faster in some circumstance > than C because of the Bots who're smart enough to optimise it up to the > hilt. > In some very, very narrow circumstances, -- very, very narrow -- sure, okay. There's some cases where it might be faster. However, that doesn't really change anything. Speed is not Python's strong point: but it doesn't matter. Its fast enough, partly because it is indeed very very productive and programmer time is an extremely valuable resource. And partly because its actually pretty easy to build extension modules for it to optimize away bottlenecks. The 90/10 rule means that it actually doesn't *matter* that it is slow: since 90% of the program's time is spent in 10% of the code, if you write that 90% in Python you'll save man-months or man-years of development, and a drop in the bucket writing some more optimized extension to handle the 10% will pay off hugely. Or you could just use one of many already wrapped libraries that are very fast and efficient (like, numpy, or what not). Embrace it, don't fight it. Or people will come in and go, "Python is slow! You all suck!" and you'll be defensive, and enter into some big pointless argument, and no one will change their mind, and hours and hours of productive time will be wasted in the debate. The proper response is to shrug, be indifferent, and say, "Its as fast as it needs to be.(*)" :) --S P.S. *Which is not to say I wouldn't welcome the Unladen Swallow improvements or anything. More speed is never /bad/, as long as its not at the cost of our precious dynamic soul, but really-- it is fast enough. -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On 25/06/2010 22:25, Stephen Hansen wrote: On Fri, Jun 25, 2010 at 1:51 PM, Mark Lawrencewrote: On 25/06/2010 16:34, Stephen Hansen wrote: Python's slow, sure. But its in practice fast enough for an extremely broad range of activities. What? What, what? --S Python is *NOT* slow, you can develop software in it much faster than you can in some other languages. The run time speed has also been shown to be faster in some circumstance than C because of the Bots who're smart enough to optimise it up to the hilt. Sorry for my earlier abrupt response, but I'm still traumatised by the thought of England vs Germany on Sunday and maybe penalties. :) Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On Fri, Jun 25, 2010 at 1:51 PM, Mark Lawrence wrote: > On 25/06/2010 16:34, Stephen Hansen wrote: > > Python's slow, sure. But its in practice fast enough for an extremely >> broad >> range of activities. >> >> > What? > What, what? --S -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On 25/06/2010 16:34, Stephen Hansen wrote: Python's slow, sure. But its in practice fast enough for an extremely broad range of activities. What? Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On Thu, Jun 24, 2010 at 7:52 PM, Peng Yu wrote: > http://psyco.sourceforge.net/ > > The above package can improve python program on 32 bit library. But I > need to run on 64 bit library. Is there any other module that can help > improving the performance of python on 64 bit? > This is a total aside as a response, and I mean no offense by it :) But are you sure you're ready to go there? Your questions have been pretty basic so far, and to go from basic to needing 64-bit performance boosts is a bit jarring. Have you profiled your code and located some bottlenecks where you've determined you need this? Python's slow, sure. But its in practice fast enough for an extremely broad range of activities. In my own personal, entirely anecdotal experience: those places where its not, I've actually often found Python wrappers for libraries that are. The lxml module for instance in some places where I do some crazy-intense xml processing. By using mature, established and fast libraries written in C(++) and wrapped in Python, I get all the benefits of their speed boosts, and don't have to even bother re-inventing the wheel myself and getting all the pesky details right. Now, true. Sometimes there isn't a square wheel already invented and you may find that place where Python's dynamic fluffy love is hiptastic and so its tripping over itself, at which point as others have noted-- Cython's what you're looking for. In my personal experience, that situation is actually really rare, though. Demonstrate you need it before you go out of your way to avoid it -- it'll save you time in the future, I think :) --S -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On Fri, Jun 25, 2010 at 7:01 AM, Tim Wintle wrote: > On Thu, 2010-06-24 at 21:52 -0500, Peng Yu wrote: >> http://psyco.sourceforge.net/ >> >> The above package can improve python program on 32 bit library. But I >> need to run on 64 bit library. Is there any other module that can help >> improving the performance of python on 64 bit? > > As I understand it, Psycho isn't likely to get updated to 64-bit unless > someone decides to supply a significant amount of funding to the > developers. > > If you've on a platform where compiling C is easy then I'd highly > recommending using Cython for objects that have to be high-performance: > http://cython.org/ > > (It generates C from slightly modified python code - I use it on various > 64-bit *nix platforms) > > Otherwise you could write a standard C extension. > > The major native-code generation projects that I know of are Pypy and > Unladen Swallow, but neither of them are ready for use on 64-bit. > > > Tim Assuming you really need something like psyco, Cython's the way to go- but you may want to look into writing a C extension, too. I've found in some cases that it can actually be easier than using ctypes or Cython. Geremy Condra PS- a brief note, at some point this week the browser extension I use to swap the 'reply' and 'reply to all' buttons decided to die, so if you've gotten an offlist reply from me during that period, sorry about that. -- http://mail.python.org/mailman/listinfo/python-list
Re: improving python performance by extension module (64bit)
On Thu, 2010-06-24 at 21:52 -0500, Peng Yu wrote: > http://psyco.sourceforge.net/ > > The above package can improve python program on 32 bit library. But I > need to run on 64 bit library. Is there any other module that can help > improving the performance of python on 64 bit? As I understand it, Psycho isn't likely to get updated to 64-bit unless someone decides to supply a significant amount of funding to the developers. If you've on a platform where compiling C is easy then I'd highly recommending using Cython for objects that have to be high-performance: http://cython.org/ (It generates C from slightly modified python code - I use it on various 64-bit *nix platforms) Otherwise you could write a standard C extension. The major native-code generation projects that I know of are Pypy and Unladen Swallow, but neither of them are ready for use on 64-bit. Tim -- http://mail.python.org/mailman/listinfo/python-list
improving python performance by extension module (64bit)
http://psyco.sourceforge.net/ The above package can improve python program on 32 bit library. But I need to run on 64 bit library. Is there any other module that can help improving the performance of python on 64 bit? -- Regards, Peng -- http://mail.python.org/mailman/listinfo/python-list