Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68038

Re: Python performance

Date 2014-03-08 07:40 -0600
From Tim Chase <python.list@tim.thechases.com>
Subject Re: Python performance
References <290bb6ed-a17e-45e3-8ff7-e58bb50e66a6@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.7930.1394286032.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 2014-03-08 04:53, JCosta 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 ?

It depends.

Did you write C#/Java in Python (i.e., use C# or Java idioms in
Python), or did you write Pythonic code?

Check your algorithms and storage classes for performance
characteristics (if you used an O(1) algorithm/container in C#/Java
but used an O(N) algorithm/container in Python) and make sure they
match.

What sorts of operations are you doing?  Are you CPU-bound, I/O
bound, or memory-bound?  Have you profiled to see where the hot-spots
are?

Personally, I've found that most of my code is I/O-bound (disk or
network), and that very rarely has CPU been much of a problem
(usually checking my algorithm if there's trouble; occasionally I'm
stuck with an O(N^2) algorithm and no language-choice.  For some
folks, using one of the specialty-math libraries can speed up numeric
processing.  If I know that memory could be an issue, I tend to switch
to a disk-based data-stores to head off any trouble.

-tkc



Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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