Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Robert Bradshaw
On Thu, Apr 19, 2012 at 11:49 PM, Dag Sverre Seljebotn wrote: > On 04/20/2012 08:21 AM, Stefan Behnel wrote: >> >> Robert Bradshaw, 20.04.2012 02:52: >>> >>> On Thu, Apr 19, 2012 at 3:53 AM, mark florisson wrote: On 19 April 2012 08:17, Dag Sverre Seljebotn wrote: > > On 04/19/20

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Dag Sverre Seljebotn
On 04/20/2012 08:49 AM, Dag Sverre Seljebotn wrote: On 04/20/2012 08:21 AM, Stefan Behnel wrote: Robert Bradshaw, 20.04.2012 02:52: On Thu, Apr 19, 2012 at 3:53 AM, mark florisson wrote: On 19 April 2012 08:17, Dag Sverre Seljebotn wrote: On 04/19/2012 08:41 AM, Stefan Behnel wrote: Dag Sver

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Dag Sverre Seljebotn
On 04/20/2012 08:21 AM, Stefan Behnel wrote: Robert Bradshaw, 20.04.2012 02:52: On Thu, Apr 19, 2012 at 3:53 AM, mark florisson wrote: On 19 April 2012 08:17, Dag Sverre Seljebotn wrote: On 04/19/2012 08:41 AM, Stefan Behnel wrote: Dag Sverre Seljebotn, 18.04.2012 23:35: from numpy import s

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Stefan Behnel
Robert Bradshaw, 20.04.2012 02:52: > On Thu, Apr 19, 2012 at 3:53 AM, mark florisson wrote: >> On 19 April 2012 08:17, Dag Sverre Seljebotn wrote: >>> On 04/19/2012 08:41 AM, Stefan Behnel wrote: Dag Sverre Seljebotn, 18.04.2012 23:35: > > from numpy import sqrt, sin > > cdef d

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Robert Bradshaw
On Thu, Apr 19, 2012 at 3:53 AM, mark florisson wrote: > On 19 April 2012 08:17, Dag Sverre Seljebotn > wrote: >> On 04/19/2012 08:41 AM, Stefan Behnel wrote: >>> >>> Dag Sverre Seljebotn, 18.04.2012 23:35: from numpy import sqrt, sin cdef double f(double x):     return

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Dag Sverre Seljebotn
Nathaniel Smith wrote: >On Thu, Apr 19, 2012 at 2:18 PM, Dag Sverre Seljebotn > wrote: >> On 04/19/2012 01:20 PM, Nathaniel Smith wrote: >>> @cython.inline >>> def square(x): >>>     return x * x >>> >>> # .specialize is an un-standardized Cython interface >>> # square_double is an object imple

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Nathaniel Smith
On Thu, Apr 19, 2012 at 2:18 PM, Dag Sverre Seljebotn wrote: > On 04/19/2012 01:20 PM, Nathaniel Smith wrote: >> @cython.inline >> def square(x): >>     return x * x >> >> # .specialize is an un-standardized Cython interface >> # square_double is an object implementing the standardized C-callable

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Dag Sverre Seljebotn
On 04/19/2012 01:20 PM, Nathaniel Smith wrote: On Thu, Apr 19, 2012 at 11:56 AM, Dag Sverre Seljebotn wrote: I thought of some drawbacks of getfuncptr: - Important: Doesn't allow you to actually inspect the supported signatures, which is needed (or at least convenient) if you want to use an

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Dag Sverre Seljebotn
On 04/19/2012 01:11 PM, Stefan Behnel wrote: Dag Sverre Seljebotn, 19.04.2012 13:05: Pure speculation though I think we should leave speculation to the CPUs. They are quite good at it these days. Yes, I agree, given these benchmarks, we should focus on a) Usability in C b) Simplicity c)

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Stefan Behnel
Vitja Makarov, 19.04.2012 10:35: > I've tried to implement trivial approach for CyFunction. Trivial means > that function accepts PyObjects as arguments and returns an PyObject, > so trivial signature is only one integer: 1 + len(args). If signature > match occurs dirct C-function is called and PyO

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Stefan Behnel
Vitja Makarov, 19.04.2012 13:20: > Ok, np.sqrt() supports different signatures how would cython know > which C-function to use? You might want to read through this mailing list thread and the CEP. Stefan ___ cython-devel mailing list cython-devel@python

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Nathaniel Smith
On Thu, Apr 19, 2012 at 11:56 AM, Dag Sverre Seljebotn wrote: > I thought of some drawbacks of getfuncptr: > >  - Important: Doesn't allow you to actually inspect the supported > signatures, which is needed (or at least convenient) if you want to use an > FFI library or do some JIT-ing. So an iter

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Vitja Makarov
2012/4/19 Dag Sverre Seljebotn : > On 04/19/2012 10:35 AM, Vitja Makarov wrote: >> >> 2012/4/19 Dag Sverre Seljebotn: >>> >>> On 04/19/2012 08:41 AM, Stefan Behnel wrote: Dag Sverre Seljebotn, 18.04.2012 23:35: > > > from numpy import sqrt, sin > > cdef double f(d

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Stefan Behnel
Dag Sverre Seljebotn, 19.04.2012 13:05: > Pure speculation though I think we should leave speculation to the CPUs. They are quite good at it these days. Stefan ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Dag Sverre Seljebotn
On 04/19/2012 12:56 PM, Dag Sverre Seljebotn wrote: On 04/19/2012 11:07 AM, Nathaniel Smith wrote: On Wed, Apr 18, 2012 at 10:58 PM, Dag Sverre Seljebotn wrote: On 04/18/2012 11:35 PM, Dag Sverre Seljebotn wrote: On 04/17/2012 02:24 PM, Dag Sverre Seljebotn wrote: On 04/13/2012 12:11 AM, D

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Dag Sverre Seljebotn
On 04/19/2012 11:07 AM, Nathaniel Smith wrote: On Wed, Apr 18, 2012 at 10:58 PM, Dag Sverre Seljebotn wrote: On 04/18/2012 11:35 PM, Dag Sverre Seljebotn wrote: On 04/17/2012 02:24 PM, Dag Sverre Seljebotn wrote: On 04/13/2012 12:11 AM, Dag Sverre Seljebotn wrote: Travis Oliphant recentl

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread mark florisson
On 19 April 2012 08:17, Dag Sverre Seljebotn wrote: > On 04/19/2012 08:41 AM, Stefan Behnel wrote: >> >> Dag Sverre Seljebotn, 18.04.2012 23:35: >>> >>> from numpy import sqrt, sin >>> >>> cdef double f(double x): >>>     return sqrt(x * x) # or sin(x * x) >>> >>> Of course, here one could get the

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Dag Sverre Seljebotn
On 04/19/2012 10:35 AM, Vitja Makarov wrote: 2012/4/19 Dag Sverre Seljebotn: On 04/19/2012 08:41 AM, Stefan Behnel wrote: Dag Sverre Seljebotn, 18.04.2012 23:35: from numpy import sqrt, sin cdef double f(double x): return sqrt(x * x) # or sin(x * x) Of course, here one could get the p

Re: [Cython] CEP1000: Native dispatch through callables

2012-04-19 Thread Nathaniel Smith
On Wed, Apr 18, 2012 at 10:58 PM, Dag Sverre Seljebotn wrote: > On 04/18/2012 11:35 PM, Dag Sverre Seljebotn wrote: >> >> On 04/17/2012 02:24 PM, Dag Sverre Seljebotn wrote: >>> >>> On 04/13/2012 12:11 AM, Dag Sverre Seljebotn wrote: Travis Oliphant recently raised the issue on the NumPy

Re: [Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Vitja Makarov
2012/4/19 Dag Sverre Seljebotn : > On 04/19/2012 08:41 AM, Stefan Behnel wrote: >> >> Dag Sverre Seljebotn, 18.04.2012 23:35: >>> >>> from numpy import sqrt, sin >>> >>> cdef double f(double x): >>>     return sqrt(x * x) # or sin(x * x) >>> >>> Of course, here one could get the pointer in the modu

[Cython] New early-binding concept [was: CEP1000]

2012-04-19 Thread Dag Sverre Seljebotn
On 04/19/2012 08:41 AM, Stefan Behnel wrote: Dag Sverre Seljebotn, 18.04.2012 23:35: from numpy import sqrt, sin cdef double f(double x): return sqrt(x * x) # or sin(x * x) Of course, here one could get the pointer in the module at import time. That optimisation would actually be very w