Skip to main content

Speedups

https://github.com/wolph/speedups/actions/workflows/build_wheels.yml/badge.svg https://github.com/wolph/speedups/actions/workflows/tox.yml/badge.svg

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.4.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.4.0
File Size Uploaded
speedups-1.4.0.tar.gz 176.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for speedups 1.4.0
File
speedups-1.4.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
speedups-1.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
speedups-1.4.0-cp312-cp312-macosx_10_9_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.9+ x86-64 Details
speedups-1.4.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
speedups-1.4.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.4.0-cp311-cp311-macosx_12_0_x86_64.whl CPython 3.11 CPython 3.11 macOS 12.0+ x86-64 Details
speedups-1.4.0-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details
speedups-1.4.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
speedups-1.4.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.4.0-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details
speedups-1.4.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
speedups-1.4.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.4.0-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
speedups-1.4.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
speedups-1.4.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.4.0-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details

Total release size: 7.0 MB

Release files / speedups-1.4.0.tar.gz

Download URL speedups-1.4.0.tar.gz
Size 176.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6458a2f732f0487c70a6ffcb3aa7da4ab0b092166585210db5334f83549d5e82
BLAKE2b-256 checksum
How to use checksums
adbdcc96f153b96f7eb5949720d6ea2a96a04a9c9e0a2ed146959a8e1209d91d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.3

Release files / speedups-1.4.0-cp312-cp312-win_amd64.whl

Download URL speedups-1.4.0-cp312-cp312-win_amd64.whl
Size 263.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
13d70bb49fd3d4785f1fa30d240934d3417808b8da09470cf7a522efefd340df
BLAKE2b-256 checksum
How to use checksums
0aa10e1077ea356d7ecbc164962d999b55bdfb1bd1f3ea9dd166585f0cc89363
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / speedups-1.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL speedups-1.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 787.5 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
01f7da5188f805e8ddd68b49cbed08bc9b38c7919d79ad74c8002d538f1c5c78
BLAKE2b-256 checksum
How to use checksums
3c0658beba59bbeda0c3250d0adacc4983fb5e82db4eee9ebbf392b582491877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / speedups-1.4.0-cp312-cp312-macosx_10_9_x86_64.whl

Download URL speedups-1.4.0-cp312-cp312-macosx_10_9_x86_64.whl
Size 279.4 kB
Tags CPython 3.12 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
45011bda14236e58a43f9143165c74e68d6f46924070c51c47a832cb1c13c3ee
BLAKE2b-256 checksum
How to use checksums
66072a70c722971901f247f694a285771119d3492f21c22c4b2f53fd6ce7334f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp311-cp311-win_amd64.whl
Size 263.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
8db868526434050a8e7adb164d4205dfe5ca3d1600c1674a2565d3b2660d9a0b
BLAKE2b-256 checksum
How to use checksums
e8634f18ae845d8b817b5a8a7c26d8d7a4476b08620ba7b75d227ca47a6ee2b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 793.8 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d8e4b4695ef085749244ac4cdbcb33679815de9b79ae12945bc5162b78c59bf3
BLAKE2b-256 checksum
How to use checksums
081f2118c484dbaec8db18435ef029d9a4edb324cd43541981ede774bdd5ec17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / speedups-1.4.0-cp311-cp311-macosx_12_0_x86_64.whl

Download URL speedups-1.4.0-cp311-cp311-macosx_12_0_x86_64.whl
Size 274.6 kB
Tags CPython 3.11 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
98581e3a3216b6425633eb865c200a6376f8f8d56c7ed78ab9ecbf9261db459b
BLAKE2b-256 checksum
How to use checksums
ad5c25a4d6e0e023cf6e82a5f13ecf684f5d2ba94bbfd9784498b2457c65908a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.3

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

Download URL speedups-1.4.0-cp311-cp311-macosx_10_9_x86_64.whl
Size 276.4 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
ac7de083eccaea68a61e9709eef1027daaff1653ce2728040ce027b41dfbc75c
BLAKE2b-256 checksum
How to use checksums
f416bbd1e040e4674d5857fa9d5d569c416ac00bbe6bccf6ae0208733fa73aa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp310-cp310-win_amd64.whl
Size 263.0 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
901e1089db8b6d089dfc12327cbacadfb762277a36e1835e822d3258104f439a
BLAKE2b-256 checksum
How to use checksums
e6a12a1aaec72c41fb18252cec1054398476f2b89befceda54e70ba78baeaf28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 743.7 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f357c74e91922b1430061161aec240a69e3a993ccc51bcc13f584a25d69ca391
BLAKE2b-256 checksum
How to use checksums
e1b58a36e8c0b781402792bff3d007354684752bbf79b3923494caa955455623
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Size 276.8 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
60be6a2276923bf3390101898a627b2f62410b75b20e053a75f8fb2e7d4c5135
BLAKE2b-256 checksum
How to use checksums
70f82f555ac47e6958dcf435f78b8cba3f7fd4a021f45c7e7b0fd1bc1ea6f11a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp39-cp39-win_amd64.whl
Size 263.5 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
dbc1652d7c9dfd5b358939460feb7c064581cb52421f0e1f77246350f6eca557
BLAKE2b-256 checksum
How to use checksums
0d472ccd790a6be8ffa1137dee0123257b5998ce092d5ba282db07799002d72d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 746.0 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
510f03ea39805afc8f6126e546915dc29e1579e959ed68303af6d110ff3c3244
BLAKE2b-256 checksum
How to use checksums
dcb8be2f5448734f670099ee8ad4401f5b2975608084c8d53a05701cc2b7f3a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Size 277.4 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
51b1c49baf0626352986a62b974aaaba63a535c4064c161e4f7ad880dff75b61
BLAKE2b-256 checksum
How to use checksums
1d08cc7039a7567d90554a1018e15994225716f05497a75343ae355afdbcd16b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp38-cp38-win_amd64.whl
Size 263.6 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
6d66ec97f52456900093a708a0aec838e70c1c9f7975056ced5ceb42ca801e33
BLAKE2b-256 checksum
How to use checksums
3a3d693d319361ee2a644b2abdf5b3e0f5c7e9f57acc0ce21a3af8642f018bfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 754.2 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
baea077f04bd61bdf0858fed72d23e01d6b36d8a7f61ad6531a15414a0c0dbf1
BLAKE2b-256 checksum
How to use checksums
b8ff4fd6191434df0f203590f2d7539a3f4be763fcbb847ad861f4b2b907df07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

Download URL speedups-1.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Size 275.7 kB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
25e21c93ce06d1621c0da18155af799b7524e60b9a40423e550c036ba9b27ef6
BLAKE2b-256 checksum
How to use checksums
c92ec7e1d695f5f24d894c1b49d193789c3211100e7b7c7e898984e3af46ac71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

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

This release

1.4.0 This release

17 release files

1.3.2

16 release files

1.3.0

2 release files

1.2.0

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