Re: why does dead code costs time?

2012-12-12 Thread Ramchandra Apte
On Sunday, 9 December 2012 22:17:09 UTC+5:30, Mark Lawrence wrote: On 09/12/2012 14:11, Ramchandra Apte wrote: peehole haha Double spaced crap from you again not so haha. -- Cheers. Mark Lawrence. haha. What does Cheers mean? --

Re: why does dead code costs time?

2012-12-12 Thread Steven D'Aprano
On Wed, 12 Dec 2012 21:23:47 -0800, Ramchandra Apte wrote: Cheers. Mark Lawrence. haha. What does Cheers mean? It is an exclamation expressing good wishes. In particular, good wishes before drinking. Think of it as a variation on: Good health to you Best wishes Sincerest regards only

Re: why does dead code costs time?

2012-12-12 Thread rusi
On Dec 13, 11:01 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 12 Dec 2012 21:23:47 -0800, Ramchandra Apte wrote: Cheers. Mark Lawrence. haha. What does Cheers mean? It is an exclamation expressing good wishes. In particular, good wishes before drinking.

Re: why does dead code costs time?

2012-12-12 Thread Cameron Simpson
On 12Dec2012 22:27, rusi rustompm...@gmail.com wrote: | On Dec 13, 11:01 am, Steven D'Aprano steve | +comp.lang.pyt...@pearwood.info wrote: | On Wed, 12 Dec 2012 21:23:47 -0800, Ramchandra Apte wrote: | Cheers. | Mark Lawrence. | | haha. What does Cheers mean? | | It is an exclamation

Re: why does dead code costs time?

2012-12-12 Thread rusi
On Dec 13, 11:51 am, Cameron Simpson c...@zip.com.au wrote: It looked good-natured, she thought;  Still it had very long claws and a great many teeth, so she felt it ought to be treated with respect. heh! If only we could respect without such coercion(s) --

Re: why does dead code costs time?

2012-12-12 Thread Chris Angelico
On Thu, Dec 13, 2012 at 5:59 PM, rusi rustompm...@gmail.com wrote: On Dec 13, 11:51 am, Cameron Simpson c...@zip.com.au wrote: It looked good-natured, she thought; Still it had very long claws and a great many teeth, so she felt it ought to be treated with respect. heh! If only we could

Re: why does dead code costs time?

2012-12-09 Thread Ramchandra Apte
On Wednesday, 5 December 2012 22:10:51 UTC+5:30, Bruno Dupuis wrote: On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: On 2012-12-05, Bruno Dupuis python.ml.bruno.dup...@lisael.org wrote: Hi, I'm interested in compilers optimizations, so I study python

Re: why does dead code costs time?

2012-12-09 Thread Mark Lawrence
On 09/12/2012 14:11, Ramchandra Apte wrote: peehole haha Double spaced crap from you again not so haha. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
Hi, I'm interested in compilers optimizations, so I study python compilation process I ran that script: import timeit def f(x): return None def g(x): return None print(x) number = 1 print(timeit.timeit('f(1)',setup=from __main__ import f,

Re: why does dead code costs time?

2012-12-05 Thread Neil Cerutti
On 2012-12-05, Bruno Dupuis python.ml.bruno.dup...@lisael.org wrote: Hi, I'm interested in compilers optimizations, so I study python compilation process I ran that script: import timeit def f(x): return None def g(x): return None print(x)

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: On 2012-12-05, Bruno Dupuis python.ml.bruno.dup...@lisael.org wrote: Hi, I'm interested in compilers optimizations, so I study python compilation process I ran that script: import timeit def f(x):

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 05:40:51PM +0100, Bruno Dupuis wrote: On Wed, Dec 05, 2012 at 04:15:59PM +, Neil Cerutti wrote: Maybe it's the difference between LOAD_CONST and LOAD_GLOBAL. We can wonder why g uses the latter. Good point! I didn't even noticed that. It's weird... Maybe the

Re: why does dead code costs time?

2012-12-05 Thread Steven D'Aprano
On Wed, 05 Dec 2012 16:46:39 +0100, Bruno Dupuis wrote: Hi, I'm interested in compilers optimizations, so I study python compilation process I ran that script: import timeit def f(x): return None def g(x): return None print(x) number

Re: why does dead code costs time?

2012-12-05 Thread Steven D'Aprano
On Wed, 05 Dec 2012 17:34:57 +, Steven D'Aprano wrote: I believe that's a leftover from early Python days when None was not a keyword and could be reassigned. Oops! Wrong copy and paste! Here's a simpler version: [steve@ando ~]$ python1.5 Python 1.5.2 (#1, Aug 27 2012, 09:09:18) [GCC

Re: why does dead code costs time?

2012-12-05 Thread Ian Kelly
On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The difference is almost certain between the LOAD_CONST and the LOAD_GLOBAL. As to *why* there is such a difference, I believe that's a leftover from early Python days when None was not a keyword and

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The difference is almost certain between the LOAD_CONST and the LOAD_GLOBAL. As to *why* there is such a difference, I believe that's a

Re: why does dead code costs time?

2012-12-05 Thread Terry Reedy
On 12/5/2012 1:24 PM, Bruno Dupuis wrote: On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The difference is almost certain between the LOAD_CONST and the LOAD_GLOBAL. As to *why* there is

Re: why does dead code costs time?

2012-12-05 Thread Chris Kaynor
On Wed, Dec 5, 2012 at 12:41 PM, Terry Reedy tjre...@udel.edu wrote: On 12/5/2012 1:24 PM, Bruno Dupuis wrote: On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: I think this should even be considered a bug, not just a missing optimization. Consider: This is definitely a bug

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
On Wed, Dec 05, 2012 at 03:41:19PM -0500, Terry Reedy wrote: On 12/5/2012 1:24 PM, Bruno Dupuis wrote: On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote: On Wed, Dec 5, 2012 at 10:34 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The difference is almost certain

Re: why does dead code costs time?

2012-12-05 Thread Bruno Dupuis
I added a patch on the issue tracker. It solves the bug for short (32700 bytes) functions ref : http://bugs.python.org/file28217/16619-1.patch -- Bruno Dupuis -- http://mail.python.org/mailman/listinfo/python-list

Re: why does dead code costs time?

2012-12-05 Thread Tim Roberts
Bruno Dupuis python.ml.bruno.dup...@lisael.org wrote: On Wed, Dec 05, 2012 at 05:40:51PM +0100, Bruno Dupuis wrote: Good point! I didn't even noticed that. It's weird... Maybe the difference comes from a peehole optim on f which is not possible on g as g is to complex. Neil, you were right,