Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2014-03-10 Thread David Naylor
On Friday, 26 August 2011 06:37:30 Armin Rigo wrote: > Hi David, > > On Thu, Aug 25, 2011 at 9:44 PM, David Naylor wrote: > > Below is the patch, and results, for my proposed hash methods for > > datetime.datetime (and easily adaptable to include tzinfo and the other > > datetime objects). I tr

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-25 Thread Armin Rigo
Hi David, On Thu, Aug 25, 2011 at 9:44 PM, David Naylor wrote: > Below is the patch, and results, for my proposed hash methods for > datetime.datetime (and easily adaptable to include tzinfo and the other > datetime objects).  I tried to make the hash safe for both 32bit and 64bit > systems, and

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-25 Thread David Naylor
On Tuesday, 16 August 2011 15:27:30 Armin Rigo wrote: > Hi David, > > On Mon, Aug 15, 2011 at 6:20 PM, David Naylor wrote: > > For me the performance of datetime object's hashing is sufficient but I > > think the python code could use some performance improvements. Is my > > approach using a di

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-16 Thread Armin Rigo
Hi David, On Mon, Aug 15, 2011 at 6:20 PM, David Naylor wrote: > For me the performance of datetime object's hashing is sufficient but I think > the python code could use some performance improvements.  Is my approach using > a direct computation to type long acceptable (in principle).  If so I c

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-15 Thread Antonio Cuni
On 15/08/11 15:36, Alex Gaynor wrote: I'd like to express that, unless we have a very compelling reason, we should try to keep more stuff in pure python, as opposed to RPython. Mostly because it speeds up translation ;) (also easier to test, easier to write, etc.). or, on the other hand, we sh

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-15 Thread David Naylor
On Monday, 15 August 2011 09:05:22 Armin Rigo wrote: > Hi David, > > On Sat, Aug 13, 2011 at 8:14 PM, David Naylor wrote: > > So, it appears pypy is failing to speed up this contrived example... > > I think that it is expected, because the hash is computed entirely as > pure Python code in the

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-15 Thread Armin Rigo
Hi Alex, On Mon, Aug 15, 2011 at 3:36 PM, Alex Gaynor wrote: > I'd like to express that, unless we have a very compelling reason, we should > try to keep more stuff in pure python, as opposed to RPython.  Mostly > because it speeds up translation ;) (also easier to test, easier to write, > etc.).

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-15 Thread Alex Gaynor
On Mon, Aug 15, 2011 at 2:05 AM, Armin Rigo wrote: > Hi David, > > On Sat, Aug 13, 2011 at 8:14 PM, David Naylor > wrote: > > So, it appears pypy is failing to speed up this contrived example... > > I think that it is expected, because the hash is computed entirely as > pure Python code in the c

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-15 Thread Armin Rigo
Hi David, On Sat, Aug 13, 2011 at 8:14 PM, David Naylor wrote: > So, it appears pypy is failing to speed up this contrived example... I think that it is expected, because the hash is computed entirely as pure Python code in the case of PyPy (doing integer arithmetic with overflow checks) whereas

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-13 Thread David Naylor
On Saturday, 13 August 2011 18:32:58 Antonio Cuni wrote: > On 12/08/11 17:49, David Naylor wrote: > > Would it not be a simple matter of changing the __(get|set)state method > > to use a tuple or even an int(long)? > > yes, I think it should be enough. I'm going on vacation soon and I won't > have

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-13 Thread Antonio Cuni
On 12/08/11 17:49, David Naylor wrote: Would it not be a simple matter of changing the __(get|set)state method to use a tuple or even an int(long)? yes, I think it should be enough. I'm going on vacation soon and I won't have a look at it right now, so if anybody wants to work on it, he's ver

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-12 Thread David Naylor
On Friday, 12 August 2011 14:51:36 Antonio Cuni wrote: > Hello David, > > On 10/08/11 21:27, David Naylor wrote: > > Hi, > > > > I needed to create a cache of date and time objects and I wondered what > > was the best way to handle the cache. For comparison I put together > > > the following te

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-12 Thread Antonio Cuni
On 12/08/11 14:51, Antonio Cuni wrote: @bench.bench for reference, here is the implementation of the "bench" decorator: https://bitbucket.org/antocuni/env/src/1b11491fab79/pypath/bench.py ___ pypy-dev mailing list pypy-dev@python.org http://mail.pytho

Re: [pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-12 Thread Antonio Cuni
Hello David, On 10/08/11 21:27, David Naylor wrote: Hi, I needed to create a cache of date and time objects and I wondered what was the best way to handle the cache. For comparison I put together the following test: [cut] Pypy displays significant slowdown in the defaultdict function, othe

[pypy-dev] Python vs pypy: interesting performance difference [dict.setdefault]

2011-08-10 Thread David Naylor
Hi, I needed to create a cache of date and time objects and I wondered what was the best way to handle the cache. For comparison I put together the following test: import datetime import random import timeit ranges = [datetime.datetime(2011,01, random.randint(1, 31)) for i in xrange(1000)]