Re: Bizarre additional calling overhead.

2007-11-03 Thread Chris Mellon
On Sat, 2007-11-03 at 01:08 -0300, Gabriel Genellina wrote: > En Fri, 02 Nov 2007 21:07:19 -0300, Matimus <[EMAIL PROTECTED]> escribió: > > > On Nov 2, 3:08 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > >> >>> def test_func(): > >> > >> ... pass > >> ...>>> import new > >> >>> test_func2 =

Re: Bizarre additional calling overhead.

2007-11-02 Thread Gabriel Genellina
En Fri, 02 Nov 2007 21:07:19 -0300, Matimus <[EMAIL PROTECTED]> escribió: > On Nov 2, 3:08 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: >> >>> def test_func(): >> >> ... pass >> ...>>> import new >> >>> test_func2 = new.function(test_func.func_code, {}, "test_func2") >> >>> test_func2 >> >> >

Re: Bizarre additional calling overhead.

2007-11-02 Thread Steven D'Aprano
On Fri, 02 Nov 2007 17:08:06 -0500, Chris Mellon wrote: def test_func(): > ... pass > ... import new test_func2 = new.function(test_func.func_code, {}, "test_func2") [snip results of timeit] > Why almost twice the calling overhead for a dynamic function? When I time the funct

Re: Bizarre additional calling overhead.

2007-11-02 Thread Matimus
On Nov 2, 3:08 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > >>> def test_func(): > > ... pass > ...>>> import new > >>> test_func2 = new.function(test_func.func_code, {}, "test_func2") > >>> test_func2 > > >>> test_func > > >>> import timeit > >>> tf = timeit.Timer("test_func()", "from __mai

Bizarre additional calling overhead.

2007-11-02 Thread Chris Mellon
>>> def test_func(): ... pass ... >>> import new >>> test_func2 = new.function(test_func.func_code, {}, "test_func2") >>> test_func2 >>> test_func >>> import timeit >>> tf = timeit.Timer("test_func()", "from __main__ import test_func") >>> tf.repeat() [0.2183461704377247, 0.18068215314489791,