earl / beanstalkc

A simple beanstalkd client library for Python
Apache License 2.0
457 stars 115 forks source link

libyaml #42

Closed Midnighter closed 10 years ago

Midnighter commented 10 years ago

It's not quite clear to me how to get beanstalkc to use the CLoader and CDumper libyaml classes instead of the pure Python versions. Could you elaborate on that in the Tutorial, please?

earl commented 10 years ago
import beanstalkc, yaml

def cload_yaml(x):
    return yaml.load(x, Loader=yaml.CLoader)

q = beanstalkc.Connection(parse_yaml=cload_yaml)

Does that help?

Midnighter commented 10 years ago

Cheers. I noticed that the appendix section applies to my problem just before going to bed last night but this is even more helpful.

Midnighter commented 10 years ago

Just wanted to show you this IPython Notebook. It might be interesting as an example.

earl commented 10 years ago

Thanks. If you're interested in serialisation performance, you might want to look into msgpack as well.

Midnighter commented 10 years ago

Added umsgpack to the notebook. It's a pure Python implementation so it can't really compare speed-wise but I added length checks and it's a clear winner there. Just follow the link again and it should show the new notebook.