Skip to main content

collections.namedtuple implemented in c.

Project description

An implementation of namedtuple written in c for warp speed.

Tested against Python3.4.2 and Python3.5 0a0.

Warp Speed

Time to go fast.

Setup

Use qualified imports so that we can tell which namedtuple we are using.

>>> from namedtuple import namedtuple as cnamedtuple
>>> from collections import namedtuple as stdnamedtuple
>>> from pickle import dumps, loads

Little numbers

Cute graphs

These operations scale with the number of fields.

Type creation from a string of field names.

Type creation from a string of field names.

Type creation from a sequence of field names.

Type creation from a sequence of field names.

Type creation from a sequence of field names.

Type creation from a sequence of field names.

Less cute numbers

These operations do not scale with number of fields.

std_inst is an instance of a collections.namedtuple created type with six named fields: a, b, c, d, e, and f.

In [1]: %%timeit
   ...: std_inst.c
10000000 loops, best of 3: 108 ns per loop

c_inst is an instance of a cnamedtuple.namedtuple created type with six named fields: a, b, c, d, e, and f.

In [2]: %%timeit
   ...: c_inst.c
10000000 loops, best of 3: 47.8 ns per loop

Contributing

The project is hosted on github.

Before submitting a patch, please make sure your Python code is PEP8 compliant and your c code is PEP7 compliant.

Contact

Please file all bug reports on github.

For questions or comments, feel free to email me at joe@quantopian.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cnamedtuple-0.1.3.tar.gz (10.4 kB view details)

Uploaded Source

File details

Details for the file cnamedtuple-0.1.3.tar.gz.

File metadata

  • Download URL: cnamedtuple-0.1.3.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cnamedtuple-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b041b13b5c4e06378eb86e45df0c0c32668eacdc3cfd4d75ecac955271e7fed3
MD5 d820f613dabebe2d5551b3c75e672b45
BLAKE2b-256 8e83ad55ab8eb4d80bedd8380b217dd1ce705799d91f67e78273f3ea674b30bd

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page