HNHacker News
TopNewBestAskShowJobs

fafhrd91

334 karma · joined May 16, 2012

submissionscomments
fafhrd91··on Python’s Weak Performance Matters
Python extension doesn’t mean C. Rust works perfectly for extensions, it covers a lot of low level c-api integration and it is fast. You can write whole application in rust and use python as a glue language

https://github.com/PyO3/pyo3

Pyo3 library gives you ability to work both diractions. Call python code from rust and call rust code from python.

fafhrd91··on Rust in 2018: easier to use
Good client library https://github.com/seanmonstar/reqwest Could be used as async or as sync.

Http/2 client and server https://github.com/carllerche/h2

Web framework https://github.com/actix/actix-web

All of them has good quality and performance

fafhrd91··on Rust in 2018: easier to use
There is PyO3 library

https://github.com/PyO3/pyo3

fafhrd91··on Announcing Actix web 0.3 – A small, fast, pragmatic, async rust web framework
https://github.com/actix/actix-web
fafhrd91··on Announcing Rust 1.23
I am building async web framework with http/2 and websockets support. I think rust is great! You can write high level code, but if you need to you can always access low level system

https://github.com/actix/actix-web

fafhrd91··on Interfacing Python and C: Advanced “ctypes” Features
Pyo3 support both. You can expose rust to python, and would look to python as native functions and classes or you can call python code from rust

Pyo3 uses rust refs ownership to enforce proper Gil usage. You code won’t compile if you use Gil in wrong way

fafhrd91··on Interfacing Python and C: Advanced “ctypes” Features
Sure, coupes is fine if do not need to write anything and ctypes is enough. But as soon as you need to make c to python bridge it safer to do in rust. Pyo3 handles ref counting and Gil management for you
fafhrd91··on Interfacing Python and C: Advanced “ctypes” Features
why not rust? much simpler and safer with libs like https://github.com/PyO3/pyo3
fafhrd91··on PyO3: Python Rust binding
you have two options: PyObject and Py<PyList>. Both has Send + Sync and all pyo3 types defines `std::convert::From<T>` for both.
fafhrd91··on PyO3: Python Rust binding
not really. it is an alternative to C and cython for extension development.
fafhrd91··on PyO3: Python Rust binding
this binding can be used both ways. check first example in readme. and https://github.com/PyO3/pyo3/blob/master/src/python.rs#L203
fafhrd91··on PyO3: Python Rust binding
I also wrote asyncio event loop, based on tokio-rs, using this binding. So it is possible to write complex python extensions in Rust.

https://github.com/PyO3/tokio

fafhrd91··on PyO3: Python Rust binding
sorry about not waiting longer. I didn't want to fork.

as for leaking refs, it maybe be fixed by introducing nested "Pool" objects. objective-c runtime has similar concepts and same problem with long running loops.

fafhrd91··on Rust's 2017 roadmap, six months in
PyO3 is close to first release.
fafhrd91··on Asynchronous Programming in Python: Asyncio
what is good about asyncio, it allows to replace default event loop. I am working on asyncio event loop based on tokio-rs (rust). it could bridge asyncio with code written in rust. so potentially, it should be possible to mix python and rust code on higher level than just simple c-extension.

https://github.com/PyO3

fafhrd91··on Write Fast Apps Using Async Python 3.6 and Redis
check Sanic code, it loads whole incoming payload into memory before processing it. event for 404, so I can write very simple script that would consume all memory. and you can not really protect sanic service with proxy (nginx)
fafhrd91··on Write Fast Apps Using Async Python 3.6 and Redis
problem with Sanic that it does not implement streaming properly. so it is very easy to kill any Sanic process, 10-20 seconds. again any.
fafhrd91··on Fast scraping in Python with Asyncio
it becomes more interesting when you start read streaming server request and then pipe into streaming client request.

`yield from` and asyncio makes everything much more simple.

fafhrd91··on 10 000 concurrent real-time connections to Django
Potentially it is slower than tulip, It does magic stack slicing. also it works only on X86 cpu.
← PreviousPage 2 of 2