Live data from Hacker News

Cython is 20

blog.behnel.de

31–40 of 71 posts

Re: Cython is 20

#31
post #20
post #7

While it is nice that this option is available, it would be much better if Python itself would embrance the necessary runtime capabilties to not have to rely on it.

To write fast Cython, you basically need to write in C and control everything including Python API calls. No runtime will help with this.

Common Lisp and simlar languages are a prof of what is possible.

Re: Cython is 20

#32
post #17

Earlier quoted context omitted.

Don't count on it - switch to Julia instead.

Julia is great if you can afford to spend 5 minutes sitting around for your session to load, but most people have things to do.

How many times a day are you starting sessions?

Re: Cython is 20

#33
post #17
post #7

While it is nice that this option is available, it would be much better if Python itself would embrance the necessary runtime capabilties to not have to rely on it.

Don't count on it - switch to Julia instead.

Yeah, looking forward for Julia to pressure Python.

Re: Cython is 20

#34

I love Cython. I really feel like it's the right balance of usability and allowing you to do what you want/need. Want to make your code a bit faster? Write Python with type annotations. Want to call a C library? Just import the header, and then use it from a function. Pybind11 is also great, but quite different in aims - I feel like it's more like a project for C++ programmers wanting to expose functionality to Pytho…

Python with type annotations isnt faster using python runtime.

But some packages can utilize it for higher performance but most of the time it'll be slower cause you need to parse extra information if you want to reuse it in pure python.

Re: Cython is 20

#35
post #17
post #7

While it is nice that this option is available, it would be much better if Python itself would embrance the necessary runtime capabilties to not have to rely on it.

Don't count on it - switch to Julia instead.

Would love to but community is way to small for my use case :(

Re: Cython is 20

#36
post #32

Earlier quoted context omitted.

Julia is great if you can afford to spend 5 minutes sitting around for your session to load, but most people have things to do.

How many times a day are you starting sessions?

I don't use julia, but I start python sessions multiple times per day.

Re: Cython is 20

#37

I love Cython. I really feel like it's the right balance of usability and allowing you to do what you want/need. Want to make your code a bit faster? Write Python with type annotations. Want to call a C library? Just import the header, and then use it from a function. Pybind11 is also great, but quite different in aims - I feel like it's more like a project for C++ programmers wanting to expose functionality to Pytho…

Python with type annotations isnt faster using python runtime. But some packages can utilize it for higher performance but most of the time it'll be slower cause you need to parse extra information if you want to reuse it in pure python.

It's true that if your Python code is being interpreted with CPython then adding type annotations won't make it any faster. But the comment said that if you're already compiling your Python code with Cython then adding type annotations will allow Cython to make your code a little faster.

Re: Cython is 20

#38
post #31
post #20

Earlier quoted context omitted.

To write fast Cython, you basically need to write in C and control everything including Python API calls. No runtime will help with this.

Common Lisp and simlar languages are a prof of what is possible.

Writing a much faster language runtime for a language that looks quite a bit like Python is easy. The hard problem is writing a faster language runtime that is 100% compatible with all current python programs (and their extensions) out in the world.

Re: Cython is 20

#39
post #3

and i still have no idea what i could use it for...

It's easy to drop in Cython in an existing project where you need some performance, and start gradually "cythonizing" modules from the inside out. The rest of the code does not need to care.

With a bit of care (and benchmarking) you can get very respectable speed. The main drawback is that the further you go, the more C knowledge you need in order to not blast your own feet off.

If you're just after a bit more performance in general, a drop in solution like pypy might be enough.

Re: Cython is 20

#40
post #38
post #31

Earlier quoted context omitted.

Common Lisp and simlar languages are a prof of what is possible.

Writing a much faster language runtime for a language that looks quite a bit like Python is easy. The hard problem is writing a faster language runtime that is 100% compatible with all current python programs (and their extensions) out in the world.

But this is not necessary. The python developers just need to specify this fast subset of the language, and let people use to create libraries. Over time, we would have a growing set of libraries written in the fast subset.
Post reply on HN