3 ms·
Cython 3 also uses python type annotaions to infer C types now too, so if you add python types you might see surprising cython speedups.
by ngoldbaum 3y ago
Cython 3 also uses python type annotaions to infer C types now too, so if you add python types you might see surprising cython speedups.
- ggm 3y agoComing back to this thread, I am running one now. It's too early to say if there's a speedup. But I want to note it is ridiculously under-documented how to make what I would call a functional a.out from this toolset. You basically are assumed to run python3 >>> import 'mything' and then run mything.main(args) instead of getting a functional commandline tool which "just runs" -the stepover is small, true, but I would have thought the PRIMARY use case here is commandline executable, not "embed .so in my interpreter" There are a tonne of stack overflow "how do I" and all of them are really whacked: everyone trips over the same problems of :main undefined and a swag of other problems trying to call (g)cc themselves.
- ngoldbaum 3y agoI guess it’s mismatched expectations. IMO the primary use-case is making python wrappers for C/C++ code or converting prototype Python code into a fast C extension for production use by adding types or progressively converting code into a language that is a mix of Python and C.
- ggm 3y agoThat's fair. Many happy customers so it's very likely I misunderstood the mission and vision. My primary experience in Python3 is to minimise REPL and get to commands which do stdin -> <process it> -> stdout and gang them up, or uplift discrete commands into yield() pipes inside the same interpreter. I guess I fell into the trap of going from the particular to the general.
- physicsguy 3y agoIt’s designed for building libraries really. You write functions in the foo.pyx file, Cython generates a foo.c file which gets compiled to foo.cpython-39m-x86_64-linux-gnu and then in your script you do “import foo”