Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68034
| References | <290bb6ed-a17e-45e3-8ff7-e58bb50e66a6@googlegroups.com> |
|---|---|
| Date | 2014-03-09 00:24 +1100 |
| Subject | Re: Python performance |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7928.1394285065.18130.python-list@python.org> (permalink) |
On Sat, Mar 8, 2014 at 11:53 PM, JCosta <generalcosta@gmail.com> wrote: > I did some work in c# and java and I converted some application to Python; I noticed Python is much slower than the other languages. > > Is this normal ? > Thanks The first thing to look at is the conversion. If you convert idiomatic Java code into the nearest-equivalent Python, it won't be idiomatic Python, and it'll probably underperform. (This is especially true if you create a whole lot of objects, use long chains of classes with dots, and so on. Java follows dotted name chains at compile time, Python does at run time.) Another thing to consider is that Python, while very convenient, isn't always the fastest at heavy numerical computation. For that, there are some dedicated libraries, like NumPy, which can do that for you. But it's also worth checking whether the speed difference even matters. Are you able to see a real difference, as a human, or is this just benchmarks? It's not a problem for something to take 5ms in Python that would take 2ms in Java, if that time is spent responding to a user's click - the user won't see that difference! If you post a bit of code, we can help you to see what's going on. Best bit of code to post would be the slowest - and since you're talking about performance, you _have_ profiled your code and found which bit's the slowest, right? :) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python performance JCosta <generalcosta@gmail.com> - 2014-03-08 04:53 -0800
Re: Python performance Chris Angelico <rosuav@gmail.com> - 2014-03-09 00:24 +1100
Re: Python performance Tim Chase <python.list@tim.thechases.com> - 2014-03-08 07:40 -0600
Re: Python performance Marko Rauhamaa <marko@pacujo.net> - 2014-03-08 19:48 +0200
Re: Python performance JCosta <generalcosta@gmail.com> - 2014-03-08 10:30 -0800
Re: Python performance Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-08 18:49 +0000
Re: Python performance Ned Batchelder <ned@nedbatchelder.com> - 2014-03-08 13:56 -0500
csiph-web