Blog of Rob Galanakis (@robgalanakis)

threading

Failed assertions and async functions

Armin Ronacher asked in a tweet: If you want to signal a bad calll from an async function (failed assertion). Do you … — Armin Ronacher (@mitsuhiko) February 7, 2018 I explored this quite a bit working in JavaScript on the client and feel like I have a good...

Read more

Modern computing is fast

There was a bug I fixed that I was reminded of recently. It’s was small bug – a one line fix – and it didn’t take too long to track down, but it left an impression as to how fast modern computing is. We had some code in an...

Read more

goless 0.7 released, with Python3 support and bug fixes

goless version 0.7.0 is out on PyPI. goless facilitates writing Go language style concurrent programs in Python, including functionality for channels, select, and goroutines. I forgot to blog about 0.6 at the start of July, which brought Python 3.3 and 3.4 support to goless (#17). I will support pypy3...

Read more

goless now on PyPI

goless is now available on the Python Package Index: https://pypi.python.org/pypi/goless . You can do pip install goless and get Go-like primitives to use in Python, that runs atop gevent, PyPy, or Stackless Python. You can write code like: channel = goless.chan() def goroutine(): while True: value = channel.recv() channel.send(value...

Read more

goless Benchmarks

I benchmarked how goless performs under different backends (goless is a library that provides a Go-like concurrency model for Python, on top of stackless, PyPy, or gevent). Here are the results, also available on the goless readthedocs page: Platform Backend Benchmark Time ======== ========= ============== ======= PyPy stackless chan_async...

Read more

goless- Golang semantics in Python

The goless library https://github.com/rgalanakis/goless provides Go programming language semantics built on top of Stackless Python or gevent.* Here is a Go example using channels and Select converted to goless: c1 = goless.chan() c2 = goless.chan() def func1(): time.sleep(1) c1.send('one') goless.go(func1) def func2(): time.sleep(2) c2.send('two') goless.go(func2) for i in range(2):...

Read more

Why I love blogging

I started to write a post about how I missed multithreading and speed going from C# to Python. I ended up realizing the service we built which inspired the post was poorly designed and took far more effort than it should have. The speed and multithreading of C# made...

Read more

A story of simplification and abstraction (stackless timeouts)

Someone was asking me the other day how to implement a timeout in a thread. His initial implementation used two background threads: one to do the work (making requests to a web service and updating a counter), and the other in a loop polling the counter and sleeping. If...

Read more

A use for killing tasklets

A few weeks ago, I posted about Killing Tasklets, a feature of Stackless Python that allows you to abort a tasklet at any point. And it turns out I had a perfect use case for them just last week and things went swimmingly well. We have a client program...

Read more

Killing Tasklets

Today at work we had a presentation from the venerable Kristján Valur Jónsson about killing Tasklets in Stackless Python, a technique he and partner-in-crime Matthías Guðmundsson started using for their work on DUST514. As someone who’s done some asynchronous programming, this idea sounded blasphemous. It took a little while to stew but I...

Read more

1 2