Skip to main content

This library contains a number of functions for speeding up critical parts of your Python code without having to bother with the hassle of building binary extensions. That way you can keep your main packages simple PEP517 based packages and still get the speedups.

Currently only a few functions are available, but several more are planned.

Generic endian conversion functions in speedups.hton:

  • void pack_int16(char *buf, int16_t x)

  • void pack_int32(char *buf, int32_t x)

  • void pack_int64(char *buf, int64_t x)

  • void pack_float(char *buf, float f)

  • void pack_double(char *buf, double f)

  • int16_t unpack_int16(const char *buf)

  • uint16_t unpack_uint16(const char *buf)

  • int32_t unpack_int32(const char *buf)

  • uint32_t unpack_uint32(const char *buf)

  • int64_t unpack_int64(const char *buf)

  • uint64_t unpack_uint64(const char *buf)

  • float unpack_float(const char *buf)

  • double unpack_double(const char *buf)

These functions are used to convert between native and network byte order and are meant to be used from Cython code. Examples can be found in the speedups.psycopg_array code.

For the psycopg library we have a binary COPY loader to convert a PostgreSQL array to a numpy ndarray. This can be used with the copy() method of a psycopg cursor: https://www.psycopg.org/psycopg3/docs/basic/copy.html

It supports the following PostgreSQL types:

  • float4 (numpy.float32)

  • float8 (numpy.float64)

  • smallint (numpy.int16)

  • integer (numpy.int32)

  • bigint (numpy.int64)

Additionally, it supports arrays varying from 1D to N-D so a 2D or 3D array are supported.

cursor: psycopg.Cursor
psycopg_loaders.NumpyLoader.install(cursor)

query = '''
COPY (
    SELECT array_agg(x)
    FROM generate_series(1, 100000) x
) TO STDOUT WITH BINARY
'''

copy: psycopg.Copy
with cursor.copy(query) as copy:
    copy.set_types(['integer[]'])

    for row in copy.rows():
        print(row)

Metadata

Release files for speedups 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speedups 1.2.0
File Size Uploaded
speedups-1.2.0.tar.gz 168.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for speedups 1.2.0
File
speedups-1.2.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
speedups-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
speedups-1.2.0-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details
speedups-1.2.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
speedups-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
speedups-1.2.0-cp310-cp310-macosx_12_0_x86_64.whl CPython 3.10 CPython 3.10 macOS 12.0+ x86-64 Details
speedups-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details
speedups-1.2.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
speedups-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
speedups-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
speedups-1.2.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
speedups-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
speedups-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
speedups-1.2.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
speedups-1.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
speedups-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details

Total release size: 6.8 MB

Release files / speedups-1.2.0.tar.gz

Download URL speedups-1.2.0.tar.gz
Size 168.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f44d064bf7ae214b7fa158ea9a81e6e959cff8e45adb44ff16f0526959d5dda7
BLAKE2b-256 checksum
How to use checksums
d29366d018791a09dc7197bb37deddcb677e13d3567d753dc911f4ad2f1f5f6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp311-cp311-win_amd64.whl

Download URL speedups-1.2.0-cp311-cp311-win_amd64.whl
Size 256.1 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
f2b00c0efba16193b896de7883f4763be2ada4a4b242ae8a50eeeb6d31a3c829
BLAKE2b-256 checksum
How to use checksums
54d863f923857b6df582c75cdf69bad6fb95b469cc71936825b88604622b4afc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL speedups-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 789.4 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3891d448a0e6c17539639f60b9c7e7fdc2ae05c779ce1ca3477e8c9c901ce4c7
BLAKE2b-256 checksum
How to use checksums
5677a04ae4cd5a131d242dc9cbf13a842c555f7cfb31d7ff2dd60088208a9153
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp311-cp311-macosx_10_9_x86_64.whl

Download URL speedups-1.2.0-cp311-cp311-macosx_10_9_x86_64.whl
Size 270.1 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
352193d2fb88fbb91b169f43f39256f9088ab3b04e00dd4e7fddb3bb48b66c75
BLAKE2b-256 checksum
How to use checksums
b37d28d1c86616c6c9dd56d5920158c02127876443f06a0da24ca3f855eb1707
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp310-cp310-win_amd64.whl

Download URL speedups-1.2.0-cp310-cp310-win_amd64.whl
Size 255.3 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
1dbc05420fc3fc64b5906d7cc6a7bf8aeac6041953133318f5e56db78f333292
BLAKE2b-256 checksum
How to use checksums
832698c3e6e8443ccf083ba31c81613584e5135adcc8d825493cdb61f2a68d64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL speedups-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 732.5 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f6c405449051434e810193086240c71cc37a831904cd9c065bf49145ecc1845d
BLAKE2b-256 checksum
How to use checksums
e278c57e452db7370a790adf597389da478edef9ce78bf84a61f4d2fc3e2be49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp310-cp310-macosx_12_0_x86_64.whl

Download URL speedups-1.2.0-cp310-cp310-macosx_12_0_x86_64.whl
Size 268.1 kB
Tags CPython 3.10 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
293bc46f6ab538f95444c2bbf8893e0573e959169932cac18fa4e831790ae9b0
BLAKE2b-256 checksum
How to use checksums
ee051d15fdf6fb083cd6ade5d16921165844d9496c31f5a9e9742a04d3580858
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / speedups-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl

Download URL speedups-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl
Size 269.7 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
6127be1dedc82c163f53d6d53ef45b0bdd6b1092df3c75df9ed61b1d24d1055f
BLAKE2b-256 checksum
How to use checksums
d16e8c4e175adf71ad88c24a3a6bd2042da5fc870b493338a2f3fce954441aab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp39-cp39-win_amd64.whl

Download URL speedups-1.2.0-cp39-cp39-win_amd64.whl
Size 255.8 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
6b89a06e62ef11c1eac87321ffdb99c2a2d3e310fc55d0af72a55321bd23394a
BLAKE2b-256 checksum
How to use checksums
be151eb93368d7330fc8396c8be655c4bdcdf8e8490a40940ccc5d18064a44a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL speedups-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 738.0 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9e519e7b53b8b43a88e76070c1718922838f5397143b62331d9eeeb1456dc1a1
BLAKE2b-256 checksum
How to use checksums
75a54fb243432c8c0a5cb4c6c5d13932271e0c92f73e94f1523998bce435840c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl

Download URL speedups-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl
Size 270.2 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
7578020006362620249e2cda9705be49c521161f2c5347407f47c63f27d6fb49
BLAKE2b-256 checksum
How to use checksums
8d5aa7d8337bcc6c14eb17f1c697d78d46dbf43b24f0451562a394024bffa438
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp38-cp38-win_amd64.whl

Download URL speedups-1.2.0-cp38-cp38-win_amd64.whl
Size 255.9 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
d84e003dee8c8dedd1fba26b22938fcb9ebc2294253bc76bde9a81da6410ebc1
BLAKE2b-256 checksum
How to use checksums
1cd561572b903943e0bbd1d2a29afd50eaf55d419ab8e04ff28620a4154cd784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL speedups-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 744.7 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e192bd3b6d3c1e4008ff324cc1a5aa52ec86121e1a73f4495c683ca268c90be8
BLAKE2b-256 checksum
How to use checksums
532356c60c80a74a7a9e9064ad8be929cf8f61d77eded42bd8ed5c8131f7549e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl

Download URL speedups-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Size 269.8 kB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
90a81f00436ce8ea32b0bfcbdaef74f3391ecd6611a10d1461ccddac828c3aa0
BLAKE2b-256 checksum
How to use checksums
26d2a827a1f484d5477459a69684fb75368f4e52e48d52f0faf519c365f80c9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp37-cp37m-win_amd64.whl

Download URL speedups-1.2.0-cp37-cp37m-win_amd64.whl
Size 254.7 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
b539475b8c4fb94f23d820ae951bef02bb299aa221aca43cc4907668d8053f56
BLAKE2b-256 checksum
How to use checksums
6a77f80d8913cdeb771b6e86d8864d8f2a0971bc1306be1f5d08953f13877e25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL speedups-1.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 695.7 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
55e342815108a7ab4b64e9991442e33d9831efbcfe89a7f3ce809f27000e022c
BLAKE2b-256 checksum
How to use checksums
332ee96fe12992c76068dcf0b2dd929fa090079fd50fd980478270acc0f3b7b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / speedups-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL speedups-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl
Size 269.5 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
b862fc06dfc9f4a90066ab8c53f329d9c4178b344d149b5ce273817133e0d423
BLAKE2b-256 checksum
How to use checksums
6c526b5be88801623eaa9b18cf443a5491ed8fb84b33bd77da752516e3f2aadb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

2.3.3

50 release files

2.3.2

50 release files

2.3.1

50 release files

2.3.0

50 release files

2.2.0

19 release files

2.1.0

19 release files

1.4.0

17 release files

1.3.2

16 release files

1.3.0

2 release files

This release

1.2.0 This release

17 release files

1.1.0

18 release files

1.0.0

17 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page