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


Groups > comp.lang.python > #51008

Re: How can I make this piece of code even faster?

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <joshua.landau.ws@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.024
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'output': 0.05; '(so': 0.07; 'subject:code': 0.07; 'input,': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'numpy': 0.16; 'subject:make': 0.16; 'appropriate': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'bit': 0.19; 'pfxlen:0': 0.19; 'network,': 0.22; 'cc:addr:python.org': 0.22; 'algorithms.': 0.24; 'helpful': 0.24; '(or': 0.24; 'question': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; "we're": 0.32; 'quite': 0.32; 'implemented': 0.33; 'could': 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'subject:?': 0.36; 'seconds': 0.37; 'heard': 0.39; 'subject:can': 0.39; 'how': 0.40; 'simple': 0.61; 'making': 0.63; 'july': 0.63; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'brain': 0.68; 'obvious': 0.74; 'subject:this': 0.83; 'calls,': 0.84; 'faster.': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=4qCZ1CfXgEEVwwYkiKJaqm9o0oixx/SuqLUfbN02JgE=; b=cwSd3dltzDrn0Dzkla1tBV6pF+IlvwHdyH04O9+P3oclxnw48/wbe8ISKjQLw1uccw v7GhJKShEFmMDW6H9inaLGCMon7WRvuIO5DFK7R7nU41m6G/14XP0sINWWEMyuvk7qrV n5ZPG+mjVR0+t9VDgE1GeFpDQfvPUG92L8DebOfZ/yOX+ga3JSLQOBrHxgB5QPz5UNMM Hq41pvJNJEnDbRCVFld/NKDgQayUwJyFL4eEeIa31pDSldvgZPeAFR8pAdqN4zlryxxt uskY3tkkUDzr/ICqLsyu9R4uqlZlKxWFJCmDDY3zCFZt3yFpUJFd3HrxH197GOJIB2Ve hQ9g==
X-Received by 10.112.88.169 with SMTP id bh9mr10475556lbb.12.1374406826622; Sun, 21 Jul 2013 04:40:26 -0700 (PDT)
MIME-Version 1.0
Sender joshua.landau.ws@gmail.com
In-Reply-To <6bf4d298-b425-4357-9c1a-192e6e6cd9f0@googlegroups.com>
References <6bf4d298-b425-4357-9c1a-192e6e6cd9f0@googlegroups.com>
From Joshua Landau <joshua@landau.ws>
Date Sun, 21 Jul 2013 12:39:46 +0100
X-Google-Sender-Auth uPaBBfILx4zm9AdZGDO0O76WeA0
Subject Re: How can I make this piece of code even faster?
To Pablo Barham Alzás <pablobarhamalzas@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4950.1374406833.3114.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374406833 news.xs4all.nl 15879 [2001:888:2000:d::a6]:33198
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51008

Show key headers only | View raw


On 20 July 2013 21:22,  <pablobarhamalzas@gmail.com> wrote:
> Ok, I'm working on a predator/prey simulation, which evolve using genetic algorithms. At the moment, they use a quite simple feed-forward neural network, which can change size over time. Each brain "tick" is performed by the following function (inside the Brain class):
>
<CODE>
>
> The function is actually quite fast (~0.040 seconds per 200 calls, using 10 input, 20 hidden and 3 output neurons), and used to be much slower untill I fiddled about with it a bit to make it faster. However, it is still somewhat slow for what I need it.
>
> My question to you is if you an see any obvious (or not so obvious) way of making this faster. I've heard about numpy and have been reading about it, but I really can't see how it could be implemented here.

Currently we're just guessing; if you gave us an appropriate stand-in
for "self" (so that we can call the function) we could be helpful much
more easily.

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


Thread

How can I make this piece of code even faster? pablobarhamalzas@gmail.com - 2013-07-20 13:22 -0700
  Re: How can I make this piece of code even faster? Fabio Zadrozny <fabiofz@gmail.com> - 2013-07-20 18:05 -0300
  Re: How can I make this piece of code even faster? Roy Smith <roy@panix.com> - 2013-07-20 17:25 -0400
  Re: How can I make this piece of code even faster? pablobarhamalzas@gmail.com - 2013-07-20 15:45 -0700
  Re: How can I make this piece of code even faster? Chris Angelico <rosuav@gmail.com> - 2013-07-21 08:55 +1000
  Re: How can I make this piece of code even faster? pablobarhamalzas@gmail.com - 2013-07-20 16:24 -0700
    Re: How can I make this piece of code even faster? Chris Angelico <rosuav@gmail.com> - 2013-07-21 09:29 +1000
  Re: How can I make this piece of code even faster? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-21 05:11 +0000
    Re: How can I make this piece of code even faster? Paul Rudin <paul.nospam@rudin.co.uk> - 2013-07-21 08:11 +0100
      Re: How can I make this piece of code even faster? Chris Angelico <rosuav@gmail.com> - 2013-07-21 19:21 +1000
  Re: How can I make this piece of code even faster? Peter Otten <__peter__@web.de> - 2013-07-21 09:10 +0200
  Re: How can I make this piece of code even faster? Serhiy Storchaka <storchaka@gmail.com> - 2013-07-21 10:11 +0300
  Re: How can I make this piece of code even faster? Christian Gollwitzer <auriocus@gmx.de> - 2013-07-21 09:24 +0200
  Re: How can I make this piece of code even faster? pablobarhamalzas@gmail.com - 2013-07-21 03:19 -0700
    Re: How can I make this piece of code even faster? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-21 10:31 +0000
      Re: How can I make this piece of code even faster? pablobarhamalzas@gmail.com - 2013-07-21 03:48 -0700
        Re: How can I make this piece of code even faster? Stefan Behnel <stefan_ml@behnel.de> - 2013-07-21 14:49 +0200
      Re: How can I make this piece of code even faster? Chris Angelico <rosuav@gmail.com> - 2013-07-21 20:48 +1000
    Re: How can I make this piece of code even faster? Michael Torrie <torriem@gmail.com> - 2013-07-21 09:27 -0600
  Re: How can I make this piece of code even faster? Joshua Landau <joshua@landau.ws> - 2013-07-21 12:39 +0100

csiph-web