When you run from the command prompt "cython -a ..." you get a really nice HTML file with yellow shading to indicate slow python operations vs fast C operations. You also get this same HTML file as a link every time you compile Cython code in Sage. My questions are: (1) Can I get this HTML file if I'm compiling using distutils? (2) Can I get this HTML file if I'm compiling using pyximport? Thanks in advance!!
> When you run from the command prompt "cython -a ..." you get a really nice > HTML file with yellow shading to indicate slow python operations vs fast C > operations. You also get this same HTML file as a link every time you > compile Cython code in Sage. My questions are: (1) Can I get this HTML file > if I'm compiling using distutils?
Yes, pass "annotate=True" into cythonize().
> (2) Can I get this HTML file if I'm > compiling using pyximport? Thanks in advance!!
I don't think there's a direct option for that in pyximport, but you can
always import Cython yourself and set the option globally in the Options
module.
> > When you run from the command prompt "cython -a ..." you get a really
> nice
> > HTML file with yellow shading to indicate slow python operations vs fast
> C
> > operations. You also get this same HTML file as a link every time you
> > compile Cython code in Sage. My questions are: (1) Can I get this HTML
> file
> > if I'm compiling using distutils?
> Yes, pass "annotate=True" into cythonize().
Or if not using cythonize(), you can set the flag
Cython.Compiler.Options.annotate = True
which is not documented anywhere as far as I can see
>> > When you run from the command prompt "cython -a ..." you get a really >> nice >> > HTML file with yellow shading to indicate slow python operations vs >> fast C >> > operations. You also get this same HTML file as a link every time you >> > compile Cython code in Sage. My questions are: (1) Can I get this HTML >> file >> > if I'm compiling using distutils?
>> Yes, pass "annotate=True" into cythonize().
> Or if not using cythonize(), you can set the flag
> Cython.Compiler.Options.annotate = True
> which is not documented anywhere as far as I can see
When I was digging through the source on Github, it seemed to me that you should be able to pass cython_directives={"annontate": True} as kwarg in Cython.distutils.Extension, but when I tried it it didn't work. Any thoughts?
-John
Le dimanche 17 juin 2012 20:41:43 UTC+2, Ian Bell a écrit :
>> > When you run from the command prompt "cython -a ..." you get a really >> nice
>> > HTML file with yellow shading to indicate slow python operations vs >> fast C
>> > operations. You also get this same HTML file as a link every time you
>> > compile Cython code in Sage. My questions are: (1) Can I get this HTML >> file
>> > if I'm compiling using distutils?
>> Yes, pass "annotate=True" into cythonize().
> Or if not using cythonize(), you can set the flag
> Cython.Compiler.Options.annotate = True
> which is not documented anywhere as far as I can see
On Wednesday, December 5, 2012 11:01:19 AM UTC-8, John Tyree wrote:
> When I was digging through the source on Github, it seemed to me that you > should be able to pass cython_directives={"annontate": True} as kwarg in > Cython.distutils.Extension, but when I tried it it didn't work. Any > thoughts?
> -John
> Le dimanche 17 juin 2012 20:41:43 UTC+2, Ian Bell a écrit :
>> On Sun, Jun 17, 2012 at 10:45 AM, Stefan Behnel <stef...@behnel.de>wrote:
>>> > When you run from the command prompt "cython -a ..." you get a really >>> nice
>>> > HTML file with yellow shading to indicate slow python operations vs >>> fast C
>>> > operations. You also get this same HTML file as a link every time you
>>> > compile Cython code in Sage. My questions are: (1) Can I get this HTML >>> file
>>> > if I'm compiling using distutils?
>>> Yes, pass "annotate=True" into cythonize().
>> Or if not using cythonize(), you can set the flag
>> Cython.Compiler.Options.annotate = True
>> which is not documented anywhere as far as I can see
Yes that does work. I was just wondering about the Extension class specifically. I suppose in the end it doesn't matter. I should probably just use "cythonize" anyway.
Le jeudi 6 décembre 2012 18:26:36 UTC+1, Bradley Froehle a écrit :
> On Wednesday, December 5, 2012 11:01:19 AM UTC-8, John Tyree wrote:
>> When I was digging through the source on Github, it seemed to me that you >> should be able to pass cython_directives={"annontate": True} as kwarg in >> Cython.distutils.Extension, but when I tried it it didn't work. Any >> thoughts?
>> -John
>> Le dimanche 17 juin 2012 20:41:43 UTC+2, Ian Bell a écrit :
>>> On Sun, Jun 17, 2012 at 10:45 AM, Stefan Behnel <stef...@behnel.de>wrote:
>>>> SteveB, 17.06.2012 19:34:
>>>> > (copied from
>>>> > When you run from the command prompt "cython -a ..." you get a really >>>> nice
>>>> > HTML file with yellow shading to indicate slow python operations vs >>>> fast C
>>>> > operations. You also get this same HTML file as a link every time you
>>>> > compile Cython code in Sage. My questions are: (1) Can I get this >>>> HTML file
>>>> > if I'm compiling using distutils?
>>>> Yes, pass "annotate=True" into cythonize().
>>> Or if not using cythonize(), you can set the flag
>>> Cython.Compiler.Options.annotate = True
>>> which is not documented anywhere as far as I can see
Fundamentally the distutils Extension class doesn't know anything about Cython unless you use the Cython provided build_ext command. I've found its usually easier to use cythonize which processes the pyx source and returns an Extension that distutils knows how to process.
Only drawback is that the pyx -> c conversion is run, even if you do something like `python setup.py clean`.
On Friday, December 7, 2012 4:55:32 AM UTC-8, John Tyree wrote:
> Yes that does work. I was just wondering about the Extension class > specifically. I suppose in the end it doesn't matter. I should probably > just use "cythonize" anyway.
> Le jeudi 6 décembre 2012 18:26:36 UTC+1, Bradley Froehle a écrit :
On Fri, Dec 7, 2012 at 11:07 AM, Bradley Froehle <brad.froe...@gmail.com> wrote:
> Fundamentally the distutils Extension class doesn't know anything about
> Cython unless you use the Cython provided build_ext command. I've found its
> usually easier to use cythonize which processes the pyx source and returns
> an Extension that distutils knows how to process.
> Only drawback is that the pyx -> c conversion is run, even if you do
> something like `python setup.py clean`.
A patch solving this issue would be very welcome! (I'm not sure the
best way to detect this...)
> On Friday, December 7, 2012 4:55:32 AM UTC-8, John Tyree wrote:
>> Yes that does work. I was just wondering about the Extension class
>> specifically. I suppose in the end it doesn't matter. I should probably just
>> use "cythonize" anyway.
>> Le jeudi 6 décembre 2012 18:26:36 UTC+1, Bradley Froehle a écrit :