Re: [Cython] Size of output

2020-02-01 Thread Robert Bradshaw
On Sat, Feb 1, 2020 at 6:33 AM John Skaller2 wrote: > > > given target. Removing the final 0.5% of code that is "unused in some > > cases" is really not something I would want to invest days into, each time > > we make a change in Cython. > > But its not 0.5%. My problem is trying to read the gene

Re: [Cython] Size of output

2020-02-01 Thread John Skaller2
> On 2 Feb 2020, at 03:06, Prakhar Goel wrote: > > Isn't it? > https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html#primes: > Jump down to the part where it has "annotate=True" and it describes it > in some detail. > > Also this takes all of thirty-seconds to try out and

Re: [Cython] Size of output

2020-02-01 Thread Prakhar Goel
Isn't it? https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html#primes: Jump down to the part where it has "annotate=True" and it describes it in some detail. Also this takes all of thirty-seconds to try out and the result is pretty self explanatory. -- ___

Re: [Cython] Size of output

2020-02-01 Thread Nathan
Interesting it’s not documented well, it definitely should be. It corresponds to this compiler option: https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#Cython.Compiler.Options.annotate When you turn that option on or pass -a or —annotate to the compiler, c

Re: [Cython] Status

2020-02-01 Thread John Skaller2
>> >> My concern is that the C compiler wont reject it, the program >> will corrupt data or crash: >> >> int32_t *x=..; *x = 42; >> int64_t *x=..; *x = 42; >> >> The C compiler will overwrite 4 or 8 bytes. Which one matters. > > As stated before, the C compiler will see the correct d

Re: [Cython] Size of output

2020-02-01 Thread John Skaller2
> On 2 Feb 2020, at 02:23, Stefan Behnel wrote: > > John Skaller2 schrieb am 01.02.20 um 15:32: >> My problem is trying to read the generated code. > > You might be looking for "cython -a". OK. I see these: ~/felix>../cython/cython.py usage: cython.py [-h] [-V] [-l] [-I INCLUDE_PATH] [-o OUT

Re: [Cython] Status

2020-02-01 Thread Stefan Behnel
John Skaller2 schrieb am 01.02.20 um 15:38: > On 1 Feb 2020, at 20:00, Greg Ewing wrote: >> On 1/02/20 3:29 pm, John Skaller2 wrote: >>> But the all hell breaks loose for pointers. Your hack only >>> works for rvalues. >> >> Yes, using these it's possible for Cython to accept something >> that will

Re: [Cython] Size of output

2020-02-01 Thread Stefan Behnel
John Skaller2 schrieb am 01.02.20 um 15:32: > My problem is trying to read the generated code. You might be looking for "cython -a". Stefan ___ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Status

2020-02-01 Thread John Skaller2
> On 1 Feb 2020, at 20:00, Greg Ewing wrote: > > On 1/02/20 3:29 pm, John Skaller2 wrote: >> But the all hell breaks loose for pointers. Your hack only >> works for rvalues. > > Yes, using these it's possible for Cython to accept something > that will later be rejected by the C compiler. It's

Re: [Cython] Size of output

2020-02-01 Thread John Skaller2
> given target. Removing the final 0.5% of code that is "unused in some > cases" is really not something I would want to invest days into, each time > we make a change in Cython. But its not 0.5%. My problem is trying to read the generated code. A possibility might be an option which puts the bo

Re: [Cython] Size of output

2020-02-01 Thread Stefan Behnel
Robert Bradshaw schrieb am 01.02.20 um 00:49: > Taking a quick glance at an auto-generated file for an empty .pyx, we have > [...] > ~300 lines module setup code. Even for trivial modules, we still > declare and call functions for creating globals, preparing types, etc. > even if we don't have any

Re: [Cython] Status

2020-02-01 Thread Greg Ewing
On 1/02/20 3:29 pm, John Skaller2 wrote: But the all hell breaks loose for pointers. Your hack only works for rvalues. Yes, using these it's possible for Cython to accept something that will later be rejected by the C compiler. It's not perfect, but it gets the job done most of the time. -- Gr