Skip to content

perf idea: add option to generate wheel via mypyc #766

Description

@chirizxc

Summary

We can precompile some parts of the code to slightly improve performance, thanks to the typed code, mypyc will compile the *.c extension for the files

It will look something like this:

setup.py:

import os

from setuptools import setup

if os.environ.get("USE_MYPYC") == "1":
    import glob

    from mypyc.build import mypycify

    files = glob.glob("src/**/*.py", recursive=True)
    ext_modules = mypycify(files)
else:
    ext_modules = []

setup(ext_modules=ext_modules)

We could either leave it up to the user, or compile the wheels ourselves and publish them to PyPI. The latter, however, would significantly increase CI runtime.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions